#include <sys/types.h> #include <sys/stat.h> int stat(char pathname, struct stat *info);
stat
gets status information for an OpenEdition HFS file and returns
it in a stat
structure, defined in <stat.h>
.
The file pathname is pathname
. You must specify the pathname
as an OpenEdition HFS
file. For programs not compiled with the posix
option, a style prefix
may be required. See File Naming Conventions for information on specifying
OpenEdition filenames. info
is the area of memory in which the status
information is stored. The <sys/stat.h>
header file contains a collection of
macros that you can use to examine properties of a mode_t
value from the
st_mode
field. See the fstat
function for information about these
macros.
stat
returns 0 if it is successful and
- 1 if it is not successful.
"."
or ".."
in the paths.) In this example, two different HFS files must
have either different device numbers or different inode numbers:
#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> int samefile(const char *path1, const char *path2) { struct stat stat1, stat2; int rc; rc = stat(path1, &stat1); if (rc == -1) { perror("stat error"); return -1; } rc = stat(path2, &stat2); if (rc == -1) { perror("stat error"); return -1; } if (stat1.st_dev == stat2.st_dev && stat1.st_ino == stat2.st_ino) return 1; else return 0; }
cmsstat
, fattr
, fstat
, lstat
,
osddinfo
, osdsinfo
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.