SPL to HP C/XL Migration Guide (30231-90001)

9- 4
| FUPDATE(
filenum
,
buffer
,
length
) Update logical record in file |
| FWRITE(
filenum
,
buffer
,
length
,
ctlcode
) Write logical record to sequential file |
| FWRITEDIR(
filenum
,
buffer
,
length
,
lrecnum
) Write logical record to direct access file |
| HPFOPEN(
filenum
,
status
[,
itemnum
,
item
][...]) Open file; return
filenum
, 32-bit file |
| number |
| PRINT(
message
,
length
,
ctlcode
) Write string to $STDLIST |
| READ(
message
,
expectedlength
) Read string from $STDIN; return actual |
| length |
| READX(
message
,
expectedlength
) Read string from $STDINX; return actual |
| length |
-------------------------------------------------------------------------------------------
Table 9-2 and Table 9-3 describe briefly the HP C/XL standard library I/O
macros and functions that you may wish to use in converting your SPL
programs. See the
HP C/XL Library Reference Manual
for details.
Table 9-2. HP C/XL I/O Macros
-------------------------------------------------------------------------------------------
| Macro Description |
-------------------------------------------------------------------------------------------
| getc(
stream
) Read one character from file
stream
|
| getchar() Read one character from stdin |
| putc(
c
,
stream
) Write one character
c
to file
stream
|
| putchar(
c
) Write one character
c
to stdout |
-------------------------------------------------------------------------------------------
Table 9-3. HP C/XL I/O Functions
-------------------------------------------------------------------------------------------
| Function Description |
-------------------------------------------------------------------------------------------
| access(
filename
,
access
) Test accessibility of file |
| clearerr(
stream
) Clear error and eof conditions on file |
|
stream
|
| close(
fildes
) Close file
fildes
|
| dup(
fildes
) Duplicate file descriptor
fildes
|
| fclose(
stream
) Close file
stream
; flush buffer |
| fdopen(
fildes
) Get
stream
pointer from
fildes
file |
| descriptor |
| feof(
stream
) Test file
stream
for end-of-file |
-------------------------------------------------------------------------------------------
| ferror(
stream
) Test file
stream
for error |
| fflush(
stream
) Flush buffer to file
stream
|
| fgetc(
stream
) Read one character from file
stream
|
| fgets(
string
,
n
,
stream
) Read
n
-1 chars from file
stream
(or up to |
| '\n') |
| fopen(
filename
,
type
) Open file
filename
; return
stream
(pointer |
| to FILE) |
| fprintf(
stream
,
format
[,
item
][...]) Convert from internal
item
; write to file |
|
stream
|
| fputc(
c
,
stream
) Write one character
c
to file
stream
|
-------------------------------------------------------------------------------------------
| fputs(
string
,
stream
) Write
string
(up to '\0') to file
stream
|
| fread(
ptr
,
size
,
nitems
,
stream
) Read fixed-length binary records from file |
|
stream
|
| freopen(
filename
,
type
,
stream
) Change file attached to
stream
|
| fscanf(
stream
,
format
[,
item
][...]) Read from
stream
; convert to internal
item
|
| fseek(
stream
,
offset
,
ptrname
) Set byte position in file
stream
|
| ftell(
stream
) Return byte position of file
stream
|
| fwrite(
ptr
,
size
,
nitems
,
stream
) Write fixed-length binary records to file |
|
stream
|
-------------------------------------------------------------------------------------------
| gets(
string
) Read
string
from stdin |
| getw(
stream
) Read int word from file
stream
|
| lseek(
fildes
,
offset
,
ptrname
) Set byte position in file
fildes
|
| open(
filename
,
oflag
,
mode
,
mpeopts
) Open file
filename
; return
fildes
(int file|
| descriptor) |
| printf(
format
[,
item
][...]) Convert from internal
item
; write to stdout|
| puts(
string
) Write
string
(up to '\0') to stdout |
| putw(
word
,
stream
) Write int
word
to file
stream
|
-------------------------------------------------------------------------------------------