There are three types of input and output (I/O) in the DEC C Run-Time Library (RTL): UNIX, Standard, and Terminal. Table 2-1 lists all the I/O functions and macros found in the DEC C RTL. For more detailed information on each function and macro, see the Reference Section.
| Function or Macro | Description |
|---|---|
| UNIX I/O-Opening and Closing Files | |
| close | Closes the file associated with a file descriptor. |
| creat | Creates a new file. |
| dup, dup2 | Allocates a new descriptor that refers to a file specified by a file descriptor returned by open, creat, or pipe. |
| open | Opens a file and positions it at its beginning. |
| UNIX I/O-Reading from Files | |
| read | Reads bytes from a file and places them in a buffer. |
| UNIX I/O-Writing to Files | |
| write | Writes a specified number of bytes from a buffer to a file. |
| UNIX I/O-Maneuvering in Files | |
| lseek | Positions a stream file to an arbitrary byte position and returns the new position as an int. |
| UNIX I/O- Additional Standard I/O Functions and Macros | |
| fstat, stat | Accesses information about the file descriptor or the file specification. |
| fsync | Writes to disk any buffered information for the specified file. |
| getname | Returns the file specification associated with a file descriptor. |
| isapipe | Returns 1 if the file descriptor is associated with a pipe and 0 if it is not. |
| isatty | Returns 1 if the specified file descriptor is associated with a terminal and 0 if it is not. |
| lwait | Waits for completion of pending asynchronous I/O. |
| ttyname | Returns a pointer to the null-terminated name of the terminal device associated with file descriptor 0, the default input device. |
| Standard I/O-Opening and Closing Files | |
| fclose | Closes a function by flushing any buffers associated with the file control block, and freeing the file control block and buffers previously associated with the file pointer. |
| fdopen | Associates a file pointer with a file descriptor returned by an open, creat, dup, dup2, or pipe function. |
| fopen | Opens a file by returning the address of a FILE structure. |
| freopen | Substitutes the file, named by a file specification, for the open file addressed by a file pointer. |
| Standard I/O-Reading from Files | |
| fgetc, getc, getw, getwc | Returns characters from a specified file. |
| fgets, fgetws | Reads a line from a specified file and stores the string in an argument. |
| fread | Reads a specified number of items from a file. |
| fscanf, fwscanf | Performs formatted input from a specified file. |
| sscanf, swscanf | Performs formatted input from a character string in memory. |
| ungetc, ungetwc | Pushes back a character into the input stream and leaves the stream positioned before the character. |
| Standard I/O-Writing to Files | |
| fprintf, fwprintf, vfprintf, vfwprintf | Performs formatted output to a specified file. |
| fputc, putc, putw, putwc | Writes characters to a specified file. |
| fputs, fputws | Writes a character string to a file without copying the string's null terminator. |
| fwrite | Writes a specified number of items to a file. |
| sprintf, swprintf, vsprintf, vswprintf | Performs formatted output to a string in memory. |
| Standard I/O-Maneuvering in Files | |
| fflush | Sends any buffered information for the specified file to RMS. |
| fgetpos | Stores the current value of the file position indicator for the stream. |
| fsetpos | Sets the file position indicator for the stream according to the value of the object pointed to. |
| fseek | Positions the file to the specified byte offset in the file. |
| ftell | Returns the current byte offset to the specified stream file. |
| rewind | Sets the file to its beginning. |
| Standard I/O-Additional Standard I/O Functions and Macros | |
| access | Checks a file to see whether a specified access mode is allowed. |
| clearerr | Resets the error and end-of-file indications for a file. |
| feof | Tests a file to see if the end-of- file has been reached. |
| ferror | Returns a nonzero integer if an error has occurred while reading or writing a file. |
| fgetname | Returns the file specification associated with a file pointer. |
| fileno | Returns an integer file descriptor that identifies the specified file. |
| fwait | Waits for completion of pending asynchcronous I/O. |
| fwide | Sets the orientation a stream. |
| mktemp | Creates a unique file name from a template. |
| remove, delete | Deletes a file. |
| rename | Gives a new name to an existing file. |
| setbuf, setvbuf | Associates a buffer with an input or output file. |
| tmpfile | Creates a temporary file that is opened for update. |
| tmpnam | Creates a character string that can be used in place of the file-name argument in other function calls. |
| Terminal I/O-Reading from Files | |
| getchar, getwchar | Reads a single character from the standard input (stdin). |
| gets | Reads a line from the standard input (stdin). |
| scanf, wscanf | Performs formatted input from the standard input. |
| Terminal I/O-Writing to Files | |
| printf, wprintf, vprintf, vwprintf | Performs formatted output to the standard output (stdout). |
| putchar, putwchar | Writes a single character to the standard output and returns the character. |
| puts | Writes a character string to the standard output followed by a new-line character. |