File_TimeModified()

Parent Previous Next

File_TimeModified(bDay As Byte, bMonth As Byte, bYear As Byte, bHours As Byte, bMinutes As Byte, bSeconds As Byte)


bDay (Byte): The day of the month (1–31).

bMonth (Byte): The month (1–12).

bYear (Byte): The year, starting from 2000 (e.g., for 2024, use 24).

bHours (Byte): The hour in 24-hour format (0–23).

bMinutes (Byte): The minutes (0–59).

bSeconds (Byte): The seconds (0–59).


Set the Modified Property of a File


File_TimeModified() is used to set the "Modified" timestamp for a file. This timestamp reflects the date and time when the file was last modified. The values are used to preload the "Modified" property, which will then be written to the file when it is closed using File_Close() or flushed using File_Flush().


Example:

File_TimeModified(2,11,24, 21,32,55)


When to Use:

• Before closing a file: You can use File_TimeModified() to ensure the file has the correct "Modified" timestamp.

• Before flushing a file: If you want to ensure the "Modified" property is updated when you call File_Close()  or File_Flush(), you can set the time in advance.


Notes:

• The Modified property is not updated immediately; it is saved when the file is closed or flushed.

• You must call File_Close()  or File_Flush() to ensure the new "Modified" timestamp is written to the file.

• When you open a file using  File_Open(), File_Append(), or File_OpenAt() File_TimeModified() will read the current value from the file. If you want to change the current "Modified" property, you will need to issue the new values with File_TimeModified() after the file has been opened. 


TftSetUp(0)                                                                                 'Set screen

TftResetScreen(BLACK)                                                                       'Reset screen

TftSetSndFont(0,0)                                                                          'Set Font0

While File_Init() <> cErrOK : Wend                                                          'Initialize SD Card

TftPrintSndString("Sd Initialization OK",1,0,0,1,GREEN,BLACK,0)                             'Confirm Initialize SD Card

File_TimeModified(5,11,24, 12,39,45)                                                        'Set modified property

While File_Append("append.log") <> cErrOK : Wend                                            'Open file append.log to edit data

TftPrintSndString("Append append.log OK",1,0,2,1,GREEN,BLACK,0)                             'Confirm append.log is open 

sString = " world!"                                                                         'Load string with data to be written

For bCounter = 0 To 12    

    If sString[bCounter] = 0 Then Break                                                     'break if end of string

    File_WriteByte(sString[bCounter])                                                       'write data to append.Log

Next

If File_Flush() = 1 Then 

    TftPrintSndString("Append append.Log OK",1,0,3,1,GREEN,BLACK,0)                         'confirm flush ok and good to remove card

Else

    TftPrintSndString("Append append.Log NO",1,0,3,1,GREEN,BLACK,0)                         'flush not ok and not good to remove card

EndIf 






Created with the Personal Edition of HelpNDoc: Create Professional CHM Help Files with HelpNDoc's Easy-to-Use Tool