| fread | Function (tigcc.a)

stdio.h

unsigned short fread (void *ptr, unsigned short size, unsigned short n, FILE *stream);

Reads data from a stream.

fread reads n items of data, each of length size bytes, from the input stream associated with the structure pointed to by stream into a block pointed to by ptr. The total number of bytes read is n x size. fread fread returns the number of items (not bytes) actually read. If the operation was sucessful, the returned result should be equal to n. In a case of error, returned result will be smaller (possibly zero).
Note: fread is proposed to be used in "binary" mode (see fopen). Although this is not strictly necessary, it is is highly recommended opening stream in "binary" mode if you want to use this function. Anyway, there will not be any character translations during reading, even if the file is opened in "text" mode. This function was buggy in releases of TIGCCLIB prior to 2.2; this is now fixed.

Uses: fgetc