1.2.7.4.17 SYS_FS_FileStringGet Function
1.2.7.4.17 C
SYS_FS_RESULT SYS_FS_FileStringGet
(
SYS_FS_HANDLE handle,
char* buff,
uint32_t len
);
1.2.7.4.17 Summary
Reads a string from the file into a buffer.
1.2.7.4.17 Description
This function reads a string of specified length from the file into a buffer. The read operation continues until:
'\n' is stored
reached end of the file or
the buffer is filled with len - 1 characters. The read string is terminated with a '\0'.
1.2.7.4.17 Precondition
The file from which a string has to be read, has to be present and should have been opened.
1.2.7.4.17 Parameters
| Parameters | Description |
|---|---|
| handle | Handle of the file from which string is to be read |
| buff | Buffer in which the string is to be stored |
| len | Length of string to be read |
1.2.7.4.17 Returns
SYS_FS_RES_SUCCESS - String read operation was successful.
SYS_FS_RES_FAILURE - String read operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error or SYS_FS_FileError.
1.2.7.4.17 Example
SYS_FS_RESULT res; SYS_FS_HANDLE fileHandle; char CACHE_ALIGN buffer[100]; fileHandle = SYS_FS_FileOpen("/mnt/myDrive/FILE.txt", (SYS_FS_FILE_OPEN_WRITE_PLUS)); if(fileHandle != SYS_FS_HANDLE_INVALID) { // File open is successful } // Read a string from the file. res = SYS_FS_FileStringGet(fileHandle, buffer, 50); if( res != SYS_FS_RES_SUCCESS) { //String read operation failed. }
1.2.7.4.17 Remarks
None.
