ClassesClassesClassesClasses | | | | Operators

fread_stringfread_stringFreadStringfread_stringFreadStringFreadString (Operator)

Name

fread_stringfread_stringFreadStringfread_stringFreadStringFreadString — Read strings from a file.

Signature

fread_string( : : FileHandle : OutString, IsEOF)

Herror fread_string(const Hlong FileHandle, char* OutString, Hlong* IsEOF)

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

Herror fread_string(const HTuple& FileHandle, char* OutString, Hlong* IsEOF)

HTuple HFile::FreadString(HTuple* IsEOF) const

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

HString HFile::FreadString(Hlong* IsEOF) const

void HOperatorSetX.FreadString(
[in] VARIANT FileHandle, [out] VARIANT* OutString, [out] VARIANT* IsEOF)

BSTR HFileX.FreadString([out] Hlong* IsEOF)

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

string HFile.FreadString(out int isEOF)

Description

The operator fread_stringfread_stringFreadStringfread_stringFreadStringFreadString reads a string from the current input file defined by the handle FileHandleFileHandleFileHandleFileHandleFileHandlefileHandle. 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 OutStringOutStringOutStringOutStringOutStringoutString. If the end of the file is reached, IsEOFIsEOFIsEOFIsEOFIsEOFisEOF returns the value 1, otherwise 0.

Parallelization

Parameters

FileHandleFileHandleFileHandleFileHandleFileHandlefileHandle (input_control)  file HFile, HTupleHTupleHFile, HTupleHFileX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

File handle.

OutStringOutStringOutStringOutStringOutStringoutString (output_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Read character sequence.

IsEOFIsEOFIsEOFIsEOFIsEOFisEOF (output_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (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)

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_stringFreadStringfread_stringFreadStringFreadString returns the value 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Possible Predecessors

open_fileopen_fileOpenFileopen_fileOpenFileOpenFile

Possible Successors

close_fileclose_fileCloseFileclose_fileCloseFileCloseFile

Alternatives

fread_charfread_charFreadCharfread_charFreadCharFreadChar, read_stringread_stringReadStringread_stringReadStringReadString, fread_linefread_lineFreadLinefread_lineFreadLineFreadLine

See also

open_fileopen_fileOpenFileopen_fileOpenFileOpenFile, close_fileclose_fileCloseFileclose_fileCloseFileCloseFile, fread_charfread_charFreadCharfread_charFreadCharFreadChar, fread_linefread_lineFreadLinefread_lineFreadLineFreadLine

Module

Foundation


ClassesClassesClassesClasses | | | | Operators