Chapter Contents

Previous

Next
Function Categories

I/O Functions

The SAS/C library provides a large set of input/output functions. These functions are divided into two groups, standard I/O functions and UNIX style I/O functions.

The library's I/O implementation is designed to

The library provides several I/O techniques to meet the needs of different applications. To achieve the best results, you must make an informed choice about the techniques to use. Criteria that should influence your choice are

To make these choices, you need to understand general C I/O concepts as well as the native I/O types and file structures supported by the 370 operating systems, OS/390 and CMS.

Details about C I/O concepts and functions can be found in I/O Functions.

The I/O functions are
afflush flush file buffers to disk
afopen open a file with system-dependent options
afread read a record
afread0 read a record (possibly length zero)
afreadh read part of a record
afreopen reopen a file with system-dependent options
afwrite write a record
afwrite0 write a record (possibly length 0)
afwriteh write part of a record
aopen open a file for UNIX style access with amparms
clearerr clear error flag
close close a file opened by open
_close close an HFS file
closedir close a directory
clrerr clear error flag and return status
creat create and open a file for UNIX style I/O
ctermid get a filename for the terminal
dup duplicate a file descriptor
dup2 duplicate a file descriptor to a specific file descriptor number
fattr return file attribute information
fclose close a file
fcntl control open files or sockets
_fcntl control open file descriptors for UNIX System Services (USS) HFS files
fdopen access an USS file descriptor via standard I/O
feof test for end of file
ferror test error flag
ffixed test for fixed-length records
fflush flush output buffer
fgetc read a character from a file
fgetpos store the current file position
fgets read a string from a file
fileno return file descriptor number
fnm return filename
fopen open a file
fprintf write formatted output to a file
fputc write a character to a file
fputs write a string to a file
fread read items from a file
freopen reopen a file
fscanf read formatted input from a file
fseek reposition a file
fsetpos reposition a file
fsync flush buffers for a UNIX style file to disk
_fsync flush HFS file buffers to disk
ftell obtain the current file position
fterm terminal file test
ftruncate truncate an USS file
fwrite write items to a file
getc read a character from a file
getchar read a character from the standard input stream
gets read a string from the standard input stream
isatty test for terminal file
kdelete delete current record from keyed file
kgetpos return position information for keyed file
kinsert insert record into keyed file
kreplace replace record in keyed file
kretrv retrieve next record from keyed file
ksearch search keyed file for matching record
kseek reposition a keyed stream
ktell return RBA of current record
lseek position a file opened for UNIX style access
_lseek position an USS HFS file
open open a file for UNIX style I/O
_open open an USS HFS file
opendir open an USS HFS directory
pclose close a pipe opened by popen
pipe create and open a pipe
popen open pipe I/O to an USS shell command
printf write formatted output to the standard output stream
putc write a character to a file
putchar write a character to the standard output stream
puts write a string to the standard output stream
read read data from a file opened for UNIX style access
_read read data from an USS HFS file
readdir read an USS directory entry
rewind position to start of file
rewinddir positions an USS directory stream to the beginning
scanf read formatted data from the standard input stream
setbuf change stream buffering
setvbuf change stream buffering
snprintf write a limited amount of formatted output to a string
sprintf write formatted output to a string
sscanf read formatted data from a string
tmpfile create and open a temporary file
tmpnam generate temporary filename
ttyname get name of open terminal file
ungetc push back an input character
vfprintf write formatted output to a file
vprintf write formatted output to the standard output stream
vsnprintf write a limited amount of formatted output to a string
vsprintf write formatted output to a string
write write data to a file open for UNIX-style access
_write write data to an USS HFS file.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.