Difference between revisions of "FREADSTR()"
From Lianjapedia
Yvonne.milne (Talk | contribs) m (1 revision) |
Yvonne.milne (Talk | contribs) |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to return a character string from a text file | Function to return a character string from a text file | ||
− | |||
==Syntax== | ==Syntax== | ||
FREADSTR(<expN1>, <expN2>) | FREADSTR(<expN1>, <expN2>) | ||
− | |||
==See Also== | ==See Also== | ||
− | [[FCLOSE()]], [[FCREATE()]], [[FEOF()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FSEEK()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]] | + | [[FCLOSE()]], [[FCREATE()]], [[FEOF()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FSEEK()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]] |
− | + | ||
==Description== | ==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. | 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== | ==Example== | ||
Line 34: | Line 30: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:ASCII File Access]] | [[Category:ASCII File Access]] | ||
[[Category:ASCII File Access Functions]] | [[Category:ASCII File Access Functions]] |
Revision as of 06:38, 10 February 2012
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