Chapter Contents |
Previous |
Next |
fstat |
Portability: | POSIX.1 conforming, UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <sys/types.h> #include <sys/stat.h> int fstat(int filedes, struct stat *info);
DESCRIPTION |
fstat
gets status information for an HFS file and returns it in a
stat
structure, defined in
<sys/stat.h>
. The
filedes
file descriptor is
the file descriptor for which status information is needed.
filedes
must be an open file descriptor associated with an USS HFS
file.
info
is the area of memory in which
the status information is
stored.
The
following macros
(defined in
<stat.h>
) are available:
RETURN VALUE |
fstat
returns a 0 if it is successful and a- 1 if it is not successful.
EXAMPLE |
#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> int samefile(int fd1, int fd2) { struct stat stat1, stat2; int rc; rc = fstat(fd1, &stat1); if (rc == -1) { perror("fstat error"); return -1; } rc = fstat(fd2, &stat2); if (rc == -1) { perror("fstat error"); return -1; } if (stat1.st_dev == stat2.st_dev && stat1.st_ino == stat2.st_ino) return 1; else return 0; }
RELATED FUNCTIONS |
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.