File_DiskFull()

Parent Previous Next

File_DiskFull(), Bit


Return Bit:

0: The disk is not full – there is still available space on the SD card.

1: The disk is full – no more data can be written to the card.


Check if the Disk is Full


File_DiskFull() is a variable, not a procedure, that you can check at any time to determine if the SD card (or the storage medium) is full. This can help you monitor the available space while performing file operations.


Example:

File_DiskFull()


Notes:

• This variable can be checked at any point during your program’s execution, especially before attempting to write new data to the card.

• If File_DiskFull returns 1, you should avoid writing more data to the disk, as it won't be successful until space is freed up (e.g., by deleting files or directories).


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

Repeat

    File_WriteByte("A")                                                                     'write data to append.Log

Until File_DiskFull() = 1                                                                   'If SD card is full, break

File_Close()                                                                                'Close file

TftPrintSndString("Close append.log OK",1,0,3,1,GREEN,BLACK,0)                              'Confirm append.log is closed

TftPrintSndString("Card full",1,0,4,1,GREEN,BLACK,0)                                        'Confirm card full





Created with the Personal Edition of HelpNDoc: Elevate Your Documentation with HelpNDoc's Project Analyzer Features