fread_char ( : : FileHandle : Char )

Read a character from a text file.

The operator fread_char reads a character from the current input file. If no character can be read because the end of the file is reached, fread_char returns the character sequence 'eof'. At the end of a line the value 'nl' is returned.


Parameters

FileHandle (input_control)
file -> integer
File handle.

Char (output_control)
string -> string
Read character or control string ('nl','eof').


Example
repeat >
  fread_char(FileHandle:Char) 
  (if(Char = 'nl') > fnew_line(FileHandle)) |
  (if(Char != 'nl') > fwrite_string(FileHandle,Char))  
until(Char = 'eof').

Result

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


Parallelization Information

fread_char is reentrant and processed without parallelization.


Possible Predecessors

open_file


Possible Successors

close_file


Alternatives

fread_string, read_string, fread_line


See also

open_file, close_file, fread_string, fread_line


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH