![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| stat | gajju | UNIX for Advanced & Expert Users | 6 | 09-08-2008 10:55 PM |
| How to stat X-Server on AIX 5.3 ??? | touny | AIX | 5 | 11-20-2007 07:29 AM |
| Hi errno in sys/stat.h | vijlak | High Level Programming | 6 | 11-11-2006 09:13 PM |
| Cannot Stat Error | Homer Allman | UNIX for Advanced & Expert Users | 1 | 05-22-2006 11:07 AM |
| Cannot stat? | lgardner | UNIX for Dummies Questions & Answers | 1 | 05-27-2005 05:05 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Q with stat()
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 folder does not exist, so Im curious to know what Ive done wrong Code:
struct dirent *list;
DIR *d_entry;
struct stat buff;
/*Open directory & access
elements within it*/
if( stat(list->d_name,&buff) == -1)
{
perror("stat()");
}
else
{
....
}
thanks in advance |
|
||||
|
I have another question now. Is stat() able to differ between executable files and folders accurately, or are the 2 considered the same ? Im running into this issue atm, and have tried using Code:
if(buff.st_mode == S_IFDIR)
{
...
}
without much success |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|