-
Notifications
You must be signed in to change notification settings - Fork 178
stdio
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.((Descriptions for standard functions taken from The C Programming Language, 2nd Edition by Kernighan and Ritchie))
''fopen'' opens the named file, and returns a stream, or NULL if the attempt fails. Legal vales for ''mode'' are:
- "r" open a file for reading
- "w" open a file for writing
- "a" append, open or create a file for writing at the end
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.
- Overview
- Platform List
- Unsupported Platforms
- i8080/5 Support
- Homebrew hardware quickstart
- Retargetting
- Building the libraries
- Clang support
- Pragmas
- Adding to Classic
- Introduction
- Library Configuration
- CRT
- Header Files
- Assembly Language
- Library in Depth
- Embedded Platform
- Adding to NewLib
- Benchmarks
- Datatypes
- Debugging
- Decompression
- More than 64k
- Deficiencies
- Compiling Larger Applications
- Importing routines written in 8080 assembly mnemonics
- Using CP/M libraries in REL format with z88dk
- Writing optimal code
- Speeding up Compilation
- CMake usage