File_Open(pFileName), Byte
pFileName: The name of the file to open for reading (maximum length 12 characters, including dot and extension).
Return Status:
• cErrOK: Success.
• cErrNotFound: File not found.
• cErrInUse: File number is already in use.
• cErrRWError: Read/write error.
Open a File for Reading
This procedure opens an existing file for reading only. The maximum name length is 12 characters, including the file extension.
Example:
File_Open("MyFile.txt")
Notes:
• Before reading from a file, it must be opened using File_Open().
• When the file is opened, the read pointer is moved to the beginning of the file.
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 While File_Open("Open.txt") <> cErrOK : Wend 'Open file Open.txt to edit data TftPrintSndString("Open Open.txt OK",1,0,2,1,GREEN,BLACK,0) 'Confirm Open.txt is open bCounter = 0 'Print position counter Do TftPrintSndChar(File_ReadByte(),1,bCounter,3,1,GREEN,BLACK,0) 'Print data as text If File_EOF() = 1 Then Break 'Loop till end of file Inc bCounter Loop File_Close() 'close file TftPrintSndString("Close Open.txt OK",1,0,4,1,GREEN,BLACK,0) 'Confirm close file |
|
Created with the Personal Edition of HelpNDoc: How to Protect Your PDFs with Encryption and Passwords