This function is used to read a block of data from a file that has been opened in text read mode.
Syntax |
i32 f_gets (string buff, i32 maxLen, stru_filehnd stru) |
||||||
---|---|---|---|---|---|---|---|
buff |
In buff the string read from the file is copied. The read ends when the line terminator character LF (Line Feed, code 0X0A) is encountered. The LF character is put as the last character in the string |
||||||
maxLen |
Specifies the maximum size of each string read from the file (considering the terminator character). Note: The buffer must be at least one character larger than maxLen. |
||||||
stru |
Variable of type stru_filehnd that contains the handle obtained via the f_open() function. |
||||||
Result |
Returns:
|
||||||
Validity |
Task |
||||||
Note |
If there is a string longer than maxLen in the file, it will be truncated to the maxLen length. The truncated portion will be read the next time f_gets() is called. If functions regarding compact flash management are used, it is recommended that bit 14 of the sys_cfg variable (0x00004000) be imposed to 1, to enable the use of safety routines for writing/reading flash |
Example of use:
|