Chapter 11: Predefined Macros
Read from a system file
int read(fildes, buf, nbyte)
The read macro reads from a system file. This macro is an interface to the
UNIX system call read(2). Refer to the HP-UX Reference Manual for detailed
If the system call to read(2) is successful, the number of bytes read is returned.
Otherwise, -1 is returned and a system generated error message is written to
the journal window of the debugger.
The following command file segment defines two global debugger symbols and
includes the definition of a user-defined macro that uses read().
Symbol Add int infile
Symbol Add int outfile
Debugger Macro Add int foo(infile, outfile)
/* file descriptor to read from */
/* file descriptor to write to
while (!read(infile, buf, 80))
write(outfile, buf, 80);