| Header | {z88dk}/include/stdio.h |
|---|---|
| Source | {z88dk}/libsrc/stdio |
| Include | #include <stdio.h> |
| Linking | n/a |
| Compile | n/a |
| Comments | These library functions are compiled as part of each target’s implicit library. |
These are IO functions defined as part of the C standard with some additions to suit development on Z80 based machines.
Most text reproduced here from another source.1)
fopen opens the named file, and returns a stream, or NULL if the attempt fails. Legal vales for mode are:
Not all targets support the “a” operation, depending on the implementation, files will may be truncated or fopen may return NULL.
freopen opens the file with the specified mode and associats the stream with it. It returns fp or NULL if an error occurs.
This function exists purely as a stub in z88dk.
fclose closes the stream fp.
remove removes the named file. It may not be supported for all targets.
rename renames file s so that is has the filename d. It may not be supported for all targets.
fgetc returns the next character of fp as an unsigned char, or EOF if end of file or error occurs.
fgets reads at most the next n-1 characters into the array s, stopping if a newline is encountered; the new line is included in the array which is nul terminated. fgets returns s, or NULL if end of file or an error occurs.
fputc writes the character c on stream fp. It returns the character written or EOF for error.
fputs writes the stream s on stream fp. It returns non-negative, or EOF for error.
gets reads the input line into array s. This function should not be used.
puts writes the string s and a newline to the stdout.
ungetc pushs c back onto the stream fp where it will be returned on the next read. Only one character of pushback per stream is implemented by z88dk.
fread reads from stream fp into the array ptr at most num objects of size size returning the number of objects read.
fwrite write to stream fp from the array ptr, num objects of size size returning the number of objects read.