ClassesClasses | | Operators

fread_stringT_fread_stringFreadStringFreadString (Operator)

Name

fread_stringT_fread_stringFreadStringFreadString — Read strings from a file.

Signature

fread_string( : : FileHandle : OutString, IsEOF)

Herror T_fread_string(const Htuple FileHandle, Htuple* OutString, Htuple* IsEOF)

void FreadString(const HTuple& FileHandle, HTuple* OutString, HTuple* IsEOF)

HString HFile::FreadString(Hlong* IsEOF) const

static void HOperatorSet.FreadString(HTuple fileHandle, out HTuple outString, out HTuple isEOF)

string HFile.FreadString(out int isEOF)

Description

The operator fread_stringfread_stringFreadStringFreadStringFreadString reads a string from the current input file defined by the handle FileHandleFileHandleFileHandleFileHandlefileHandle. The input file must be opened in ASCII format. A string begins with the first representable character: letters, numbers, additional characters (except blanks). A string ends when a blank or a line skip is reached. Several successive line skips are ignored. The read character sequence is returned in parameter OutStringOutStringOutStringOutStringoutString. If the end of the file is reached, IsEOFIsEOFIsEOFIsEOFisEOF returns the value 1, otherwise 0.

Execution Information

Parameters

FileHandleFileHandleFileHandleFileHandlefileHandle (input_control)  file HFile, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

File handle.

OutStringOutStringOutStringOutStringoutString (output_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Read character sequence.

IsEOFIsEOFIsEOFIsEOFisEOF (output_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Reached end of file.

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (C)

fwrite_string(FileHandle,"Please enter text and return: ..") ;
fread_string(FileHandle,&String,&IsEOF) ;
fwrite_string(FileHandle,"here it is again: ") ;
fwrite_string(FileHandle,String) ;
fnew_line(FileHandle) ;

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Result

If a file is open and a suitable string is read, fread_stringfread_stringFreadStringFreadStringFreadString returns the value 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Possible Predecessors

open_fileopen_fileOpenFileOpenFileOpenFile

Possible Successors

close_fileclose_fileCloseFileCloseFileCloseFile

Alternatives

fread_charfread_charFreadCharFreadCharFreadChar, read_stringread_stringReadStringReadStringReadString, fread_linefread_lineFreadLineFreadLineFreadLine

See also

open_fileopen_fileOpenFileOpenFileOpenFile, close_fileclose_fileCloseFileCloseFileCloseFile, fread_charfread_charFreadCharFreadCharFreadChar, fread_linefread_lineFreadLineFreadLineFreadLine

Module

Foundation


ClassesClasses | | Operators