Shiny Language Reference

Language Reference > File Functions


freadline

bool freadline(file FileVar, string Dest);

 

 

Reads a line from a file

The FREADLINE statement reads a single line from a file previously opened by FOPEN. A "single line" is a string of text terminated by a CR, LF or CRLF.

 

Parameters

FileVar

A variable declared as type FILE which has previously been associated with a file by using FOPEN.

Dest

A string variable that receives the line of text read from the file.

 

Return Value

TRUE if reading from the file suceeded and there is further data left in the file. Testing for FALSE is used to determine if the end of the file has been reached.

 

Example Code

file myfile;

if(fopen(myfile, "C:\\Readme.txt") == TRUE)
{
    bool bMoreData = TRUE;
    
    while(bMoreData)
    {
        // DataIn receives each line of text from the file
        string DataIn;
        bMoreData = freadline(myfile, DataIn);
    }
}