3. Example of file read processing
Data in SampleDir/SampleFile.txt in the SD card is read into the buf
fer.
The effective range of data read into the buffer is judged from the data size information that
is output after read processing.
■
File read processing sequence
The file read processing sequence is shown below.
● File open processing (read mode)
● File read processing
● File close processing
■
Explanation of variables
uiProcess:
Executes processing when the variable is set to 1 (read mode).
sFileName:
Specifies a directory or file name.
sReadData:
Sets a buffer into which data is to be read.
szReadSize:
Stores the size of read data after read processing.
bResult:
Substitutes the result of processing execution. (TRUE: Error occurrence, FALSE: Normal
termination)
If the result of processing execution is abnormal, check the error code of each processing.
● eOpenResult: Result of file open processing
● eReadResult: Result of file read processing
● eCloseResult: Result of file close processing
■
Operation example
● In this example, operations are performed according to the following contents of
SampleFile.txt.
NEW_DATA
ADD_DATA1
ADD_DATA2
● Read data and data size are as below.
Data (STRING type): 'NEW_DATA$R$NADD_DATA1$R$NADD_DATA2$R$NADD_DATA3'
Data size: 41
● Sample program
14.1 SD Card Access
WUME-GM1RTXOP-01 14-7