Difference between revisions of "FREADSTR()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 32: | Line 32: | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | |||
[[Category:ASCII File Access Functions]] | [[Category:ASCII File Access Functions]] |
Latest revision as of 08:20, 4 February 2013
Contents
Purpose
Function to return a character string from a text file
Syntax
FREADSTR(<expN1>, <expN2>)
See Also
FCLOSE(), FCREATE(), FEOF(), FERROR(), FFLUSH(), FGETS(), FOPEN(), FPUTS(), FREAD(), FSEEK(), FWRITE(), MEMOREAD(), MEMOWRITE()
Description
The FREADSTR() function returns the next line of a text file, opened by FOPEN(), as a character string. The <expN1> is the file pointer obtained from FOPEN(). The maximum number of bytes to read is specified by the value in <expN2>. The FREADSTR() function sequentially reads each line from the opened text file each time it is used on the file. If an error occurs during the operation, -1 is assigned to the FERROR() function. The file pointer must be assigned when the file is first opened using the FOPEN() function.
Example
use accounts fp=fopen("existing.txt") if ferror()=-1 dialog box "The file could not be opened." else string = freadstr(fp,80) do while not empty(string) ? string string = freadstr(fp,80) enddo endif fclose(fp) if ferror()=-1 dialog box "The file could not be closed." endif