File_Create()

Parent Previous Next

File_Create(pFileName), Byte


pFileName: The name of the file to be created (maximum length 12 characters, including dot and extension).


Return Status:

• cErrOK: Success.

• cErrExists: File already exists.

• cErrDiskFull: Disk is full.

• cErrRootDirFull: Root directory is full.

• cErrInUse: File number in use.

• cErrRWError: Read/write error.


Create a New File


This procedure creates a new file with the specified name. The maximum name length is 12 characters, including the file extension.


Example:

File_Create("MyFile.txt")


Notes:

• After the file is created, it remains open until closed with File_Close().

• This command also updates the file's "Created" property. If you do not specify new values using File_TimeCreated(), the default values (File_TimeCreated(1,1,24,0,0,0)) will be used.


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_TimeCreated(2,10,24,11,32,55)                                                          'Set file created property

While File_Create("pic.log") <> cErrOK : Wend                                               'Create pic.log

TftPrintSndString("pic.log create OK",1,0,1,1,GREEN,BLACK,0)                                'Confirm create Pic.log 

File_Close()                                                                                'Close pic.log

While File_Create("PiC1.TxT") <> cErrOK : Wend                                              'Create PiC1.TxT

TftPrintSndString("PiC1.TxT create OK",1,0,2,1,GREEN,BLACK,0)                               'Confirm create PiC1.TxT

File_Close()                                                                                'Close PiC1.TxT

File_CreateDir("MyFolder")                                                                  'Create MyFolder directory

TftPrintSndString("MyFolder create OK",1,0,3,1,GREEN,BLACK,0)                               'Confirm create MyFolder

File_CreateDir("Test")                                                                      'Create Test directory

TftPrintSndString("Test create OK",1,0,4,1,GREEN,BLACK,0)                                   'Confirm create Test






Created with the Personal Edition of HelpNDoc: Converting Word Documents to eBooks: A Step-by-Step Guide with HelpNDoc