fread-unsafe ( n buf alien -- count )
Factor handbook > Input and output > ANSI C streams

Prev:fgetc ( alien -- byte/f )
Next:stdin-handle ( -- alien )


Inputs and outputs
na positive integer
bufa c-ptr
aliena C FILE* handle
countan integer

Word description
Reads n bytes from a C FILE* handle into the memory referenced by buf, and outputs the number of characters read. Zero is output on end of file.

This word does not check whether buf is large enough to accommodate the requested number of bytes. Memory corruption will occur if this is not the case.

Throws an error if the input operation failed.


PRIMITIVE: fread-unsafe ( n buf alien -- count )