HP Pascal/iX Programmer's Guide (31502-90023)

B- 4
PROGRAM ErrorNo_Example;
VAR
ErrorNumber $ALIAS 'errno'$ : INTEGER;
FUNCTION Pas_Errno : integer;
BEGIN
Pas_Errno := ErrorNumber;
END;
BEGIN
END.
When another compilation unit is linked with the preceding program, it
can access the function
Pas_Errno,
which returns the value of the global
variable
errno
.
Fnum Function
The predefined function
fnum
returns the HP-UX file number of the
physical file currently associated with a given logical file. You[REV
BEG] can use this file number in system calls.[REV END]
Syntax
fnum (
filename
)
Parameter
filename
The name of the logical file. This parameter is required,
even if the logical file is the standard file
input
or
output
. The logical file must be associated with a
physical file.
Example
program xref(output);
const SEEK_SET=0; { Set file pointer to "offset" }
SEEK_CUR=1; { Set file pointer to current plus "offset" }
SEEK_END=2; { Set file pointer to EOF plus "offset" }
var s_file : text;
max : integer;
f : integer;
function lseek(fildes:integer; offset:integer; whence:integer): integer;
external;
begin
reset(s_file,'foo');
f:=fnum(s_file);
max:=lseek(f,0,seek_end);
writeln('file#:',f:1,', max bytes=',max:1);
end.
Output:
file#:3, max bytes=487
Get_alignment Function
The predefined function
get_alignment
returns the alignment requirement
of a given type or variable.
Syntax
get_alignment ({
variable
})
{
type
}