![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Q with stat() | JamesGoh | High Level Programming | 3 | 09-11-2008 09:30 PM |
| stat | gajju | UNIX for Advanced & Expert Users | 6 | 09-08-2008 09:55 PM |
| Cannot stat? | lgardner | UNIX for Dummies Questions & Answers | 1 | 05-27-2005 04:05 PM |
| stat command | emreatlier | Shell Programming and Scripting | 2 | 08-14-2003 04:03 PM |
| stat() fails!!! what can i do? | solvman | High Level Programming | 3 | 02-06-2002 05:17 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi all,
I have scenario here , In my C program i check the stat for a file as stat(fname, &stat_buf); If it is succesfull, i will process else i will make my program to fail. The file which i am checking has no stat information. What might be the reason, file has no stat information even though it has all data loaded I am using HP unix (sys05 nmx:/pmx/d4>) ll 173_i.001-rw-rw-rw- 1 pmx00 pmx 4941517719 Oct 6 13:37 173_i.001 (sys05 nmx:/pmx/d4>)stat 173_i.001Can't lstat 100373_ipd.001 Please help, stat is working for all other files , only for this file it is not working what might be the reason. Thanks in Advance, Arun |
|
||||
|
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. Code:
int stat(const char *path, struct stat *buf); int fstat(int filesdes, struct stat *buf); |
|
||||
|
This is my Code
ret = stat(fname, &stat_buf); if (ret == 0) return &stat_buf; else { fprintf(stderr,"stat: Can't get filesystem information\n"); fprintf(stderr,"stat: Current file %s\n", fname); perror("stat"); abort(); } The below is the error stat: Can't get filesystem information stat: Current file /pmx/d4/173_i.001 stat: Value too large to be stored in data type sm_au3[336]: 4740 Abort(coredump) I am trying to find the stat for a file with size 4.60215 GB , Is it caousing the problem, I mean the file size is a problem ??? Thanks in Advance, Arun |
|
||||
|
You have a largefiles problem. Base stat has a size_t st.size element. It can handle up to the max un unsigned loing value can store.
If the output of this: Code:
getconf ULONG_MAX |