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

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


Vocabulary
io.streams.c

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


Outputs
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.

Warning
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.


Errors
Throws an error if the input operation failed.

Definition

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