The stat() function call returns -1 on error. Are you checking the return code?
Then finding what errno references to produce a meaningful error message?
perror() will do that for you.
lstat() works on symlinks only -- you aren't calling lstat? Even though your error message says so.
These are the two calls you should be using. stat() is a much more likely choice.
Hi all,
I can not understand why my stat() function fails all the time when function tries to go recursevly. Someone suggested that it might be poiter problem. Please, look up my code at: www.donnelly.cc.ks.us/readdir_test.c. How can i solve this problem? Any suggestion are welcome!
Thank you... (3 Replies)
Hi! I ran into a problem with a job I'm running. All it is doing is a "touch" on a filename. However, when I ran the job, it error'd out and got the message 'cannot stat'. When I restarted the job (making no changes) it worked just fine. Anyone know what this means? (1 Reply)
From reading various articles on the net, I know stat() is used on files to get things like permissions, sizes etc... As a folder is a special type of file in Unix, I assumed that stat() could work on it as well as any general file.
However, from running my program, perror() reported that the... (3 Replies)
Hi
I am creating a utility which needs to create a log file under the path represented by an environment variable. The condition is that this path must be a valid DIRECTORY PATH. So i need to determine that the path is indeed a VALID DIRECTORY PATH.
I have written a function which will return... (2 Replies)
I'm on hp-unix. I would like a variable to hold the last change date of a file. I looked at the man pages for stat, but I don't see any examples and can't get the syntax right. Can anyone help me? Thank you. (2 Replies)
Hi,
When I use "read" to parse the sftp command sent via ptty, I ran into a very mysterious case below:
---
In Unix, the command ‘quit' is lost.
===
Fri 13Apr12 15:42:47GMT-sftp_send_command: SENT
Fri 13Apr12 15:42:47GMT-sftp_read_resp_line: Parse buffer=quit^M --> Command sent correctly... (2 Replies)
hi guys
i got confused about stat output
stat manual says
File : Size in Bytes
Blocks : Number of blocks used
IO Block : Size in bytes of every block.
when i use stat command for passwd file it says
~#stat /etc/passwd File: `/etc/passwd' Size: 999 Blocks: 8 IO... (4 Replies)
Die to what all operations, the "Modify" and "Change" values of stat output changes for a file.
I found, during editing a file, Change and Modify alters. When chmod'ing Change alters, while Modify doesnot alters. Is there more situations where these changes? (1 Reply)
Discussion started by: anil510
1 Replies
LEARN ABOUT BSD
stat
STAT(3F)STAT(3F)NAME
stat, lstat, fstat - get file status
SYNOPSIS
integer function stat (name, statb)
character*(*) name
integer statb(12)
integer function lstat (name, statb)
character*(*) name
integer statb(12)
integer function fstat (lunit, statb)
integer statb(12)DESCRIPTION
These routines return detailed information about a file. Stat and lstat return information about file name; fstat returns information
about the file associated with fortran logical unit lunit. The order and meaning of the information returned in array statb is as
described for the structure stat under stat(2). The ``spare'' values are not included.
The value of either function will be zero if successful; an error code otherwise.
FILES
/usr/lib/libU77.a
SEE ALSO stat(2), access(3F), perror(3F), time(3F)BUGS
Pathnames can be no longer than MAXPATHLEN as defined in <sys/param.h>.
4.2 Berkeley Distribution May 15, 1985 STAT(3F)