-// ----------------------------------------------------------------------------
-// $Id$
-// ----------------------------------------------------------------------------
-// Public Domain C Library - http://pdclib.sourceforge.net
-// This code is Public Domain. Use, modify, and redistribute at will.
-// ----------------------------------------------------------------------------
-// Input/output
-// ----------------------------------------------------------------------------
-
-#ifndef __STDIO_H
-#define __STDIO_H __STDIO_H
-
-// ----------------------------------------------------------------------------
-// MACROS
-
-#include "__NULL.h"
-
-#define _IOFBF // integer constant suitable as 3rd argument to setvbuf()
-#define _IOLBF // integer constant suitable as 3rd argument to setvbuf()
-#define _IONBF // integer constant suitable as 3rd argument to setvbuf()
-#define BUFSIZ // integer constant, size of the buffer used by setbuf(),
- // >= 256
-#define EOF // TODO
-#define FILENAME_MAX // length of filenames supported
-#define FOPEN_MAX // number of simultaneous open files supported, >= 8
-#define L_tmpnam // length of filenames generated by tmpnam()
-#define SEEK_CUR // integer constant suitable as 3rd argument to fseek()
-#define SEEK_END // integer constant suitable as 3rd argument to fseek()
-#define SEEK_SET // integer constant suitable as 3rd argument to fseek()
-#define TMP_MAX // number of unique filenames generateable by tmpnam(),
- // >= 25
-
-#define stderr // FILE*, not fully buffered
-#define stdin // FILE*, fully buffered only when not interactive device
-#define stdout // FILE*, fully buffered only when not interactive device
-
-// ----------------------------------------------------------------------------
-// TYPEDEFS
-
-#include "__size_t.h"
-
-typedef FILE; // object holding all stream information, including file pos,
- // buffer (optional), error indicator, EOF indicator
-typedef fpos_t; // position indicator type, other than array - personality?
- // (see mbstate_t)
-
-// ----------------------------------------------------------------------------
-// FUNCTIONS
-
-/** CLEAR ERRor. Clears EOF and error indicator of a FILE handle.
- @param fh The file handle.
- */
-void clearerr( FILE * fh );
-
-/** File CLOSE. Flush output buffers (if any) and closes the FILE handle.
- @param stream The file handle.
- @return 0 if successful, non-zero if failed. (In any case, the FILE handle
- is invalid afterwards.)
- */
-int fclose( FILE * fh );
+/* $Id$ */
-int feof( FILE * stream );
-int ferror( FILE * stream );
+/* Input/output <stdio.h>
+
+ This file is part of the Public Domain C Library (PDCLib).
+ Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#ifndef _PDCLIB_STDIO_H
+#define _PDCLIB_STDIO_H _PDCLIB_STDIO_H
+
+#ifndef _PDCLIB_INT_H
+#define _PDCLIB_INT_H _PDCLIB_INT_H
+#include <_PDCLIB_int.h>
+#endif
+
+#ifndef _PDCLIB_SIZE_T_DEFINED
+#define _PDCLIB_SIZE_T_DEFINED _PDCLIB_SIZE_T_DEFINED
+typedef _PDCLIB_size_t size_t;
+#endif
+
+#ifndef _PDCLIB_NULL_DEFINED
+#define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
+#define NULL _PDCLIB_NULL
+#endif
+
+/* See setvbuf(), third argument */
+/* Fully buffered - transmit block-wise */
+#define _IOFBF 2
+/* Line buffered - transmit line-wise */
+#define _IOLBF 1
+/* Not buffered - transmit immediately */
+#define _IONBF 0
+
+/* The following are platform-dependant, and defined in _PDCLIB_config.h. */
+typedef _PDCLIB_fpos_t fpos_t;
+typedef struct _PDCLIB_file_t FILE;
+#define EOF -1
+#define BUFSIZ _PDCLIB_BUFSIZ
+#define FOPEN_MAX _PDCLIB_FOPEN_MAX
+#define FILENAME_MAX _PDCLIB_FILENAME_MAX
+#define L_tmpnam _PDCLIB_L_tmpnam
+#define TMP_MAX _PDCLIB_TMP_MAX
+
+/* See fseek(), third argument */
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_SET 4
+
+/* Text-mode I/O is at liberty to skip non-printing characters and trailing spaces.
+ Binary I/O is at liberty to add trailing zero bytes.
+ First operation decides "orientation" of the stream (wide / byte).
+ freopen() removes orientation; see also fwide().
+ Binary wide-oriented streams have the file-positioning restrictions ascribed to both text and binary streams.
+ For wide-oriented streams, after a successful call to a file-positioning function that leaves the file position indicator prior to the end-of-file, a wide character output function can overwrite a partial multibyte character; any file contents beyond the byte(s) written are henceforth indeterminate.
+ Whether a file of zero length (unwritten-to) actually exists is implementation-defined.
+ Wide text input from file: fgetwc() / mbrtowc()
+ Wide text output to file: wcrtomb() / fputwc()
+ Multibyte encoding in file may contain embedded null bytes
+ Multibyte encoding in file need not begin / end in initial shift state.
+ Conversion may trigger EILSEQ.
+*/
-/** File FLUSH. Flushes output buffers (if any) for given file handle. If
- parameter is NULL, flushes output buffers for all file handles.
- @param fh The file handle.
- @return 0 if successful, EOF if failed (setting error indicators).
- */
-int fflush( FILE * fh );
-
-/** File OPEN. Opens the file specified by the given name.
- @param filename Name of the file to be opened.
- @param mode One of r, w, a, rb, wb, ab, r+, w+, a+, rb+, wb+, ab+,
- specifying which mode to open the file in.
- @return A file handle associated with the opened file, NULL if failed.
- */
-FILE * fopen( const char * restrict filename, const char * restrict mode );
-
-/** File REOPEN. Opens the file specified by the given name, associating it
- with the given file handle. If filename is NULL, it is attempted to change
- the mode of the already opened file associated with the given file handle.
- (This function can e.g. be used to reassociate stdin / stdout / stderr with
- a filename.)
- @param filename Name of the file to be opened.
- @param mode One of r, w, a, rb, wb, ab, r+, w+, a+, rb+, wb+, ab+,
- specifying which mode to open the file in.
- @param fh The file handle to associate with the opened file.
- @return fh if successful, NULL if failed.
- */
-FILE * freopen( const char * restrict filename, const char * restrict mode, FILE * fh );
-
-/** REMOVE file. Causes a file to be no longer accessible under a given name.
- If the file is currently open, this implementation of remove() fails,
- returning INT_MAX.
- @param filename Name of the file to be removed.
- @return 0 if successful, non-zero if failed. (Implementation defined:
- INT_MAX if the file is currently open.)
- */
+/* Operations on files */
+
+/* Remove the given file. Returns zero if successful, non-zero otherwise. If
+ the file is open, this implementation does flush its buffer and closes the
+ file before removing it. (It might be still accessible by another hard link
+ etc.
+*/
int remove( const char * filename );
-/** RENAME file. Causes a file to be no longer accessible under a given name,
- but a new name instead. If a file with the intended new name already
- exists, this implementation of rename() fails, returning INT_MAX.
- @param old Name of the file to be renamed.
- @param new Name to rename the file to.
- @return 0 if successful, non-zero if failed. (Implementation defined:
- INT_MAX if target file name already exists.)
- */
+/* Rename the given old file to the given new name. Returns zero if successful,
+ non-zero otherwise. If successful, the file can no longer be accessed under
+ its old name. If the file is open, this implementation does flush its buffer
+ and closes the file before renaming it.
+*/
int rename( const char * old, const char * new );
-void rewind( FILE * stream );
+/* Opens a temporary file with mode "wb+", i.e. binary, update. The file will
+ be removed when it is closed or the process exits normally. Returns a pointer
+ to a FILE handle for this file. This implementation does not remove temporary
+ files if the process aborts abnormally (e.g. abort()).
+*/
+FILE * tmpfile( void );
+
+/* Generates a file name that is not equal to any existing filename AT THE TIME
+ OF GENERATION. It generates a different name each time it is called. If s is
+ a NULL pointer, the name is stored in an internal static array, and a pointer
+ to that array is returned. (This is not thread-safe!) If s is not a NULL
+ pointer, it is assumed to point to an array of at least L_tmpnam characters.
+ The generated name is then stored in s, and s is returned. If tmpnam() is
+ unable to generate a suitable name (because all possible variations do exist
+ already or the function has been called TMP_MAX times already), NULL is
+ returned.
+ Note that this implementation cannot guarantee a file of this name is not
+ generated between the call to tmpnam() and a subsequent fopen().
+*/
+char * tmpnam( char * s );
+
+/* File access functions */
+int fclose( FILE * stream );
+int fflush( FILE * stream );
+FILE * fopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode );
+FILE * freopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode, FILE * _PDCLIB_restrict stream );
+void setbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf );
+int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mode, size_t size );
+
+/* Formatted input/output functions */
+int fprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... );
+int fscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... );
+int printf( const char * _PDCLIB_restrict format, ... );
+int scanf( const char * _PDCLIB_restrict format, ... );
+int snprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, ... );
+int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... );
+int sscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... );
+int vfprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vscanf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsnprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+
+/* Character input/output functions */
+
+/* Retrieve the next character from given stream. Returns the character, cast
+ to int, if successful. If EOF is reached, the EOF indicator of the stream
+ is set and EOF returned. If a read error occurs, the error indicator of the
+ stream is set and EOF returned.
+*/
+int fgetc( FILE * stream );
-/** SET Virtual BUFfer. Sets buffering mode and (optionally) the memory used
- for buffering, for a given file handle.
- This function must only be called immediately after associating the file
- handle with a file, before any operations are called on the file handle.
- @param fh The file handle.
- @param buf A pointer to the memory area to use for buffering, or NULL to
- use internally assigned buffer memory.
- @param mode One of _IOFBF, _IOLBF, _IONBF.
- @param size Size of the memory area to be used for buffering.
- */
-int setvbuf( FILE * restrict fh, char * restrict buf, int mode, size_t size );
-
-/** SET BUFfer. Equivalent to (void) setvbuf( fh, buf, _IOFBF, BUFSIZ ), or
- (void) setvbuf( fh, NULL, _IONBF, BUFSIZ ) if buf == NULL.
- @param fh The file handle to be passed to setvbuf().
- @param buf The buffer pointer to be passed to setvbuf().
- */
-void setbuf( FILE * restrict fh, char * restrict buf );
-
-/** TeMPorary FILE. Opens a file in "wb+" mode that will be automatically
- deleted when closed, or when the program terminates.
- @return A file handle for the temporary file. (NULL if opening failed.)
- */
-FILE * tmpfile( void )
-
-/** TeMPorary NAMe. Generates a random file name that does not yet exist in the
- file system. Note that a file generated with this name is not "temporary",
- and must be remove()d normally.
- @param dest NULL, or a char[ L_tmpnam ] array.
- @return A pointer to a static internal buffer containing the file name,
- or NULL if no file name could be generated. If 'dest' is not NULL,
- writes the file name to and returns 'dest'.
- */
-char * tmpnam( char * dest );
-
-int fseek( FILE * stream, long offset, int mode );
-int fsetpos( FILE * stream, const fpos_t * pos );
-int fgetpos( FILE * restrict stream, fpos_t * restrict pos );
-long ftell( FILE * stream );
+/* Reads at most n-1 characters from given stream into the array s, stopping at
+ \n or EOF. The string read is terminated with \n. Returns s if successful.
+ If EOF is encountered before any characters are read, the contents of s are
+ unchanged, and NULL is returned. If a read error occurs, the contents of s
+ are indeterminate, and NULL is returned.
+*/
+char * fgets( char * _PDCLIB_restrict s, int n, FILE * _PDCLIB_restrict stream );
-int fgetc( FILE * stream );
-char *fgets( char * restrict s, int n, FILE * restrict stream );
-size_t fread( void * restrict ptr, size_t size, size_t nelem, FILE * restrict stream );
-int getc( FILE * stream );
-int getchar( void );
+/* Write the value c (cast to unsigned char) to the given stream. Returns c if
+ successful. If a write error occurs, sets the error indicator of the stream
+ and returns EOF.
+*/
+int fputc( int c, FILE * stream );
+
+fputs( s, stream ) - write s to stream (not including terminating \0). Return >0 if
+ successful, EOF on write error. (No mention of err!)
+
+/* Write the string s (not including the terminating \0) to the given stream.
+ Returns a value >=0 if successful, EOF if a write error occurs. (The
+ standard does not mention the error indicator; this implementation does set
+ it in such a case.)
+*/
+int fputs( const char * _PDCLIB_restrict s, FILE * _PDCLIB_restrict stream );
+
+/* Equivalent to fgetc( stream ), but may be implemented as a macro that
+ evaluates its parameter more than once.
+*/
+#define getc( stream ) fgetc( stream )
+
+/* Equivalent to fgetc( stdin ), but may be implemented as a macro. */
+#define getchar() fgetc( stdin )
+
+/* Read characters from given stream into the array s, stopping at \n or EOF.
+ The string read is terminated with \0. Returns s if successful. If EOF is
+ encountered before any characters are read, the contents of s are unchanged,
+ and NULL is returned. If a read error occurs, the contents of s are indeter-
+ minate, and NULL is returned.
+*/
char * gets( char * s );
-int ungetc( int c, FILE * stream );
-int fputc( int c, FILE * stream );
-int fputs( const char * restrict s, FILE * restrict stream );
-size_t fwrite( const void * restrict ptr, size_t size, size_t nelem, FILE * restrict stream );
-void perror( const char * s );
-int putc( int c, FILE * stream );
+/* Equivalent to fputc( c, stream ), but may be implemented as a macro that
+ evaluates its parameter more than once.
+*/
+#define putc( c, stream ) fputc( c, stream )
+
+/* Equivalent to fputc( c, stdout ), but may be implemented as a macro that
+ evaluates its parameter more than once.
+*/
int putchar( int c );
+
+/* Write the string s (not including the terminating \0) to stdout, and append
+ a newline to the output. Returns a value >= 0 when successful, EOF if a
+ write error occurred.
+*/
int puts( const char * s );
-/** File SCAN Formatted. Reads from given file handle, under control of a
- formatting string, the values of variables pointed to by 0..n pointers.
- @param fh The file handle.
- @param format The formatting string.
- @param ... A list of 0..n pointers corresponding to placeholders in
- 'format'.
- @return EOF if failed, number of values successfully assigned otherwise.
- */
-int fscanf( FILE * restrict fh, const char * restrict format, ... );
-
-/** SCAN Formatted. Equivalent to fscanf( stdin, format, ... )
- @param format The formatting string.
- @param ... A list of 0..n pointers corresponding to placeholders in
- 'format'.
- @return EOF if failed, number of values successfully assigned otherwise.
- */
-int scanf( const char * restrict format, ... );
-
-/** String SCAN Formatted. Equivalent to scanf( format, ... ), but using a C
- string instead of a file handle for input.
- @param src The input string.
- @param format The formatting string.
- @param ... A list of 0..n pointers corresponding to placeholders in
- 'format'.
- @return EOF if failed, number of values successfully assigned otherwise.
- */
-int sscanf( const char * restrict src, const char * restrict format, ... );
-
-/** Variable File SCAN Formatted. Equivalent to fscanf( fh, format, ... ),
- with the variable-length parameter list replaced by a va_list, created by
- the va_start macro.
- @param fh The file handle.
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vfscanf( FILE * restrict stream, const char * restrict format, va_list args );
-
-/** Variable SCAN Formatted. Equivalent to vfscanf( stdin, format, args ).
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vscanf( const char * restrict format, va_list args );
-
-/** Variable String SCAN Formatted. Equivalent to vscanf( format, args ), but
- reading from a C string instead of stdin.
- @param src The C string to read from.
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vsscanf( const char * restrict src, const char * restrict format, va_list ap );
-
-/** File PRINT Formatted. Prints to given file handle, under control of a
- formatting string, the values of 0..n variables.
- @param fh The file handle.
- @param format The formatting string.
- @param ... A list of 0..n variables corresponding to placeholders in
- 'format'.
- @return Number of characters printed, negative value if error occurred.
- */
-int fprintf( FILE * restrict stream, const char * restrict format, ... );
-
-/** PRINT Formatted. Equivalent to fprintf( stdout, format, ... ).
- @param format The formatting string.
- @param ... A list of 0..n variables corresponding to placeholders in
- 'format'.
- @return Number of characters printed.
- */
-int printf( const char * restrict format, ... );
-
-/** String N PRINT Formatted. Equivalent to sprintf( dest, format, ... ), but
- will not write more than n characters.
- @param dest The char array to write to.
- @param n The maximum number of characters to write.
- @param format The formatting string.
- @param ... A list of 0..n variables corresponding to placeholders in
- 'format'.
- @return Number of characters printed.
- */
-int snprintf( char * restrict s, size_t n, const char * restrict format, ... );
-
-/** String PRINT Formatted. Equivalent to printf( format, ... ), but writing
- to a char array instead of stdout.
- @param dest The char array to write to.
- @param format The formatting string.
- @param ... A list of 0..n variables corresponding to placeholders in
- 'format'.
- @return Number of characters printed.
- */
-int sprintf( char * restrict dest, const char * restrict format, ... );
-
-/** Variable File PRINT Formatted. Equivalent to fprintf( fh, format, ... ),
- with the variable-length parameter list replaced by a va_list, created by
- the va_start macro.
- @param fh The file handle.
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vfprintf( FILE * restrict fh, const char * restrict format, va_list args );
-
-/** Variable PRINT Formatted. Equivalent to vfprintf( stdout, format, args ).
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vprintf( const char * restrict format, va_list args );
-
-/** Variable String N PRINT Formatted. Equivalent to vsprintf( dest, format,
- args ), but will not write more than n characters.
- @param dest The char array to write to.
- @param n Maximum number of characters to write.
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vsnprintf( char * restrict dest, size_t n, const char * restrict format, va_list ap );
-
-/** Variable String PRINT Formatted. Equivalent to vprintf( format, args ), but
- writing to a char array instead to stdout.
- @param dest The char array to write to.
- @param format The formatting string.
- @param args The argument list created by the va_start macro.
- @return Number of characters printed.
- */
-int vsprintf( char * restrict s, const char * restrict format, va_list ap);
-
-/* PDPC code - unreviewed
-/*
- What we have is an internal buffer, which is 8 characters
- longer than the actually used buffer. E.g. say BUFSIZ is
- 512 bytes, then we actually allocate 520 bytes. The first
- 2 characters will be junk, the next 2 characters set to NUL,
- for protection against some backward-compares. The fourth-last
- character is set to '\n', to protect against overscan. The
- last 3 characters will be junk, to protect against memory
- violation. intBuffer is the internal buffer, but everyone refers
- to fbuf, which is actually set to the &intBuffer[4]. Also,
- szfbuf is the size of the "visible" buffer, not the internal
- buffer. The reason for the 2 junk characters at the beginning
- is to align the buffer on a 4-byte boundary.
+/* Push the value c (cast to unsigned char) back onto the given (input) stream.
+ A character pushed back in this way will be delivered by subsequent read
+ operations (and skipped by subsequent file positioning operations) as if it
+ has not been read. The external representation of the stream is unaffected
+ by this pushback (it is a buffer operation). One character of pushback is
+ guaranteed, further pushbacks may fail. EOF as value for c does not change
+ the input stream and results in failure of the function.
+ For text files, the file position indicator is indeterminate until all
+ pushed-back characters are read. For binary files, the file position
+ indicator is decremented by each successful call of ungetc(). If the file
+ position indicator for a binary file was zero before the call of ungetc(),
+ behaviour is undefined. (Older versions of the library allowed such a call.)
+ Returns the pushed-back character if successful, EOF if it fails.
*/
+int ungetc( int c, FILE * stream );
-typedef struct
-{
-#if (defined(__OS2__) || defined(__32BIT__))
- unsigned long hfile; /* OS/2 file handle */
-#endif
-#if (defined(__MSDOS__) || defined(__DOS__) || defined(__POWERC))
- int hfile; /* dos file handle */
-#endif
-#if (defined(__MVS__))
- void *hfile;
- int recfm;
- int style;
- int lrecl;
- char ddname[9];
-#endif
- int quickBin; /* 1 = do DosRead NOW!!!! */
- int quickText; /* 1 = quick text mode */
- int textMode; /* 1 = text mode, 0 = binary mode */
- int intFno; /* internal file number */
- unsigned long bufStartR; /* buffer start represents, e.g. if we
- have read in 3 buffers, each of 512 bytes, and we are
- currently reading from the 3rd buffer, then the first
- character in the buffer would be 1024, so that is what is
- put in bufStartR. */
- char *fbuf; /* file buffer - this is what all the routines
- look at. */
- size_t szfbuf; /* size of file buffer (the one that the routines
- see, and the user allocates, and what is actually
- read in from disk) */
- char *upto; /* what character is next to read from buffer */
- char *endbuf; /* pointer PAST last character in buffer, ie it
- points to the '\n' in the internal buffer */
- int errorInd; /* whether an error has occurred on this file */
- int eofInd; /* whether EOF has been reached on this file */
- int ungetCh; /* character pushed back, -1 if none */
- int bufTech; /* buffering technique, _IOFBF etc */
- char *intBuffer; /* internal buffer */
- int noNl; /* When doing gets, we don't copy NL */
- int mode; /* __WRITE_MODE or __READ_MODE */
- int update; /* Is file update (read + write)? */
- int theirBuffer; /* Is the buffer supplied by them? */
-} FILE;
-
-typedef unsigned long fpos_t;
-
-#define NULL ((void *)0)
-#define FILENAME_MAX 260
-#define FOPEN_MAX 40
-#define _IOFBF 1
-#define _IOLBF 2
-#define _IONBF 3
-/*#define BUFSIZ 409600*/
-/* #define BUFSIZ 8192 */
-/*#define BUFSIZ 5120*/
-#define BUFSIZ 6144
-/* #define BUFSIZ 10 */
-/* #define BUFSIZ 512 */
-#define EOF -1
-#define L_tmpnam FILENAME_MAX
-#define TMP_MAX 25
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#define __NFILE (FOPEN_MAX - 3)
-#define __WRITE_MODE 1
-#define __READ_MODE 2
+/* Direct input/output functions */
+size_t fread( void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream );
+size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream );
-extern FILE *stdin;
-extern FILE *stdout;
-extern FILE *stderr;
+/* File positioning functions */
+int fgetpos( FILE * _PDCLIB_restrict stream, fpos_t * _PDCLIB_restrict pos );
+int fseek( FILE * stream, long int offset, int whence );
+int fsetpos( FILE * stream, const fpos_t * pos );
+long int ftell( FILE * stream );
+void rewind( FILE * stream );
-extern FILE *__userFiles[__NFILE];
-*/
+/* Error-handling functions */
+void clearerr( FILE * stream );
+int feof( FILE * stream );
+int ferror( FILE * stream );
+void perror( const char * s );
-#endif // __STDIO_H
+#endif