/if defined(STDIO_H) /eof /endif /define STDIO_H *----------------------------------------------------------------- * Data types *----------------------------------------------------------------- D pFILE S * based(prototype_only) *----------------------------------------------------------------- * Written by Scott Klement (http://www.scottklement.com) *----------------------------------------------------------------- * fopen(): Open File for buffered reading/writing * * filename = (input) path to file in the IFS * mode = (input) various open mode flags. (see manual) * * returns *NULL upon error, or a pointer to a FILE structure *----------------------------------------------------------------- D fopen PR ExtProc('_C_IFS_fopen') D like(pFILE) D filename * value options(*string) D mode * value options(*string) *----------------------------------------------------------------- * fgets(): read a string * * string = (output) string read (null-terminated) * size = (input) maximum size that can be stored in string * stream = (input) FILE structure to read data from * * returns a pointer to the string read from the file * or *NULL upon EOF or error. *----------------------------------------------------------------- D fgets PR * ExtProc('_C_IFS_fgets') D string * value D size 10I 0 value D stream like(pFILE) value *----------------------------------------------------------------- * fputs(): Write string * * string = (input) string to write to file * stream = (input) FILE structure designating the file to * write to. * * returns a non-negative value if successful * or -1 upon error *----------------------------------------------------------------- D fputs PR 10I 0 ExtProc('_C_IFS_fputs') D string * value options(*string) D stream like(pFILE) value *----------------------------------------------------------------- * fread(): Read items * * data = (input) data items to read * size = (input) size of each data item * count = (input) number of data items * stream = (input) pointer to FILE structure to read from * * returns the number of full items read, a short count * indicates an error. *----------------------------------------------------------------- D fread PR 10U 0 ExtProc('_C_IFS_fgets') D data * value D size 10U 0 value D count 10U 0 value D stream like(pFILE) value *----------------------------------------------------------------- * fwrite(): Write items * * data = (input) data items to write * size = (input) size of each data item * count = (input) number of data items * stream = (input) pointer to FILE structure to write to * * returns the number of full items written. A short count * indicates an error. *----------------------------------------------------------------- D fwrite PR 10U 0 ExtProc('_C_IFS_fgets') D data * value D size 10U 0 value D count 10U 0 value D stream like(pFILE) value *----------------------------------------------------------------- * fflush(): Flush a stream * * stream = (input) pointer to FILE structure to flush * * returns 0 if successful, -1 otherwise *----------------------------------------------------------------- D fflush PR 10U 0 ExtProc('_C_IFS_fflush') D stream like(pFILE) value *----------------------------------------------------------------- * fclose(): Close File * * stream = (input) pointer to FILE structure to close *----------------------------------------------------------------- D fclose PR 10I 0 ExtProc('_C_IFS_fclose') D stream like(pFILE) value *----------------------------------------------------------------- * fseek(): Reposition a file * * stream = (input) pointer to FILE structure to reposition * offset = (input) offset from "whence" in bytes * whence = (input) position to begin offset at, can be * SEEK_SET, SEEK_END or SEEK_CUR * * returns 0 if successful, -1 otherwise *----------------------------------------------------------------- D fseek PR 10I 0 ExtProc('_C_IFS_fseek') D stream like(pFILE) value D offset 10I 0 value D whence 10I 0 value *----------------------------------------------------------------- * ftell(): Get Current position * * stream = (input) pointer to FILE structure * * returns the file position, or -1 upon error *----------------------------------------------------------------- D ftell PR 10I 0 ExtProc('_C_IFS_ftell') D stream like(pFILE) value *----------------------------------------------------------------- * fdopen(): Upgrade a file descriptor to a buffered stream * * fildes = (input) file descriptor to upgrade * mode = (input) mode, equivalent to the mode specified * on the fopen() API, except that it must be * compatible with the flags that were used on * the open() API. * * Returns a new pointer to a buffered stream I/O file * or *NULL upon error. *----------------------------------------------------------------- D fdopen pr * extproc('fdopen') D fildes 10I 0 value D mode * value options(*string)