ClassesClassesClassesClasses | | | | Operators

fread_charfread_charFreadCharfread_charFreadCharFreadChar (Operator)

Name

fread_charfread_charFreadCharfread_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)

Herror fread_char(const HTuple& FileHandle, char* Char)

HTuple HFile::FreadChar() const

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

HString HFile::FreadChar() const

void HOperatorSetX.FreadChar(
[in] VARIANT FileHandle, [out] VARIANT* Char)

BSTR HFileX.FreadChar()

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

string HFile.FreadChar()

Description

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

Parallelization

Parameters

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

File handle.

CharCharCharCharCharcharVal (output_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (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_fileOpenFileopen_fileOpenFileOpenFile

Possible Successors

close_fileclose_fileCloseFileclose_fileCloseFileCloseFile

Alternatives

fread_stringfread_stringFreadStringfread_stringFreadStringFreadString, read_stringread_stringReadStringread_stringReadStringReadString, fread_linefread_lineFreadLinefread_lineFreadLineFreadLine

See also

open_fileopen_fileOpenFileopen_fileOpenFileOpenFile, close_fileclose_fileCloseFileclose_fileCloseFileCloseFile, fread_stringfread_stringFreadStringfread_stringFreadStringFreadString, fread_linefread_lineFreadLinefread_lineFreadLineFreadLine

Module

Foundation


ClassesClassesClassesClasses | | | | Operators