fgetc

This macro returns the contents of next byte from file or window. The fgetc macro name is short for [file getc() ], where file indicates that the macro operates on a file, and getc is the standard function for getting a character from a user defined file. This is distinct from the getchar function which can only retrieve a character from the standard input, which is typically the keyboard. fgetc returns the contents of the next memory location byte from the specified file or window. You define the value, or identity, of the window variable with either the FOPEN or VOPEN commands. You can also specify the file as the Standard I/O window. Any file used to read, or get, the contents of the next byte, must be opened in read mode. For example: FOPEN(100,"c:\\data_in.txt","r")

Syntax:

int fgetc (fileid)
int
fileid;

where:

fileid

The ID of the file containing the next byte to be read. This must be a user-defined fileid

Return Value

int

Returns the contents of the next byte of memory from a user specified file or window. Returns the value (-1) if either an end-of-file mark (EOF) or an error is encountered.

Rules

Any file used to read, or get, the contents of the next byte, must be opened in read mode.