ClassesClasses | | Operators

fread_charfread_charFreadCharFreadChar (Operator)

Name

fread_charfread_charFreadCharFreadChar — Read a character from a file.

Signature

fread_char( : : FileHandle : Char)

Herror fread_char(const Hlong FileHandle, char* Char)

Herror T_fread_char(const Htuple FileHandle, Htuple* Char)

void FreadChar(const HTuple& FileHandle, HTuple* Char)

HString HFile::FreadChar() const

static void HOperatorSet.FreadChar(HTuple fileHandle, out HTuple charVal)

string HFile.FreadChar()

Description

The operator fread_charfread_charFreadCharFreadCharFreadChar reads a character from the input file defined by FileHandleFileHandleFileHandleFileHandlefileHandle. The read character or control string sequence is returned in parameter CharCharCharCharcharVal. If no character can be read because the end of the file is reached, fread_charfread_charFreadCharFreadCharFreadChar returns the character sequence 'eof'"eof""eof""eof""eof".

Execution Information

Parameters

FileHandleFileHandleFileHandleFileHandlefileHandle (input_control)  file HFile, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

File handle.

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

Read character or control string ('eof').

Example (HDevelop)

* Read a file character by character.
open_file (FileName, 'input', FileHandle)
repeat
    fread_char (FileHandle, Char)
until (Char == 'eof')
close_file (FileHandle)

Result

If an input file is open, the operator fread_char returns 2 (H_MSG_TRUE). Otherwise, an exception is raised.

Possible Predecessors

open_fileopen_fileOpenFileOpenFileOpenFile

Possible Successors

close_fileclose_fileCloseFileCloseFileCloseFile

Alternatives

fread_stringfread_stringFreadStringFreadStringFreadString, read_stringread_stringReadStringReadStringReadString, fread_linefread_lineFreadLineFreadLineFreadLine

See also

open_fileopen_fileOpenFileOpenFileOpenFile, close_fileclose_fileCloseFileCloseFileCloseFile, fread_stringfread_stringFreadStringFreadStringFreadString, fread_linefread_lineFreadLineFreadLineFreadLine

Module

Foundation


ClassesClasses | | Operators