Close - HP 68000 Series User Manual

Debugger/simulator
Table of Contents

Advertisement

close

Function
Close a UNIX file
Synopsis
int close(fildes)
int
fildes;
Description
The close macro closes a UNIX file. This macro is an interface to the UNIX
system call close(2). Refer to the HP-UX Reference Manual for detailed
information.
Diagnostics
If the system call to close(2) is successful, 0 is returned. Otherwise, -1 is
returned and a system generated error message is written to the journal
window of the debugger.
Example
The following command file segment defines two global debugger symbols and
includes the definition of a user-defined macro that uses close().
Symbol Add int infile
Symbol Add int outfile
Debugger Macro Add int close_files(infile, outfile)
int
infile;
int
outfile;
{
/* close input file */
infile = close(infile);
if (infile == -1)
return 0;
/* close output file */
outfile = close(outfile);
if (outfile == -1)
return 0;
return 1;
/* both files were closed successfully */
}
Chapter 11: Predefined Macros
/* file descriptor to close */
/* file descriptor to close */
/* close failed */
/* close failed */
close
451

Advertisement

Table of Contents
loading

This manual is also suitable for:

B1466

Table of Contents