![]() |
|
#1
|
|||
|
|||
dirent, stat, compar & alphasortI was trying yo modify the directory listing example in the man pages to sort the files by time but I just don't seem to get how to do it.
Problem is that I ain't no C pro. Need help urgently..... My code is as follows: CPP / C++ / C Code:
As you can see, I even tried using the alphasort option but to no avail. Was using Turbo C but now trying to migrate to Gnu C Any help would be nice. Thanks Old_Spen Last edited by LuciWiz : 04-May-2005 at 04:29.
Reason: The correct end tag is [/c]
|
|
#2
|
||||
|
||||
|
To the tune of Wagner's Ride of the Valkries
That's Elmer Fudd's "Kill the Wabbit" to you youngsters... Read the Sticky -- Read the Sticky -- ... You need to give us more information... We can't see anything if you don't tell us where to look. __________________
Age is unimportant -- except in cheese |
|
#3
|
|||
|
|||
ClarificationQuote:
Well actually my program does not result in anything as I keep getting a warning on the illegal typecasting of a pointer to an int. The original program for listing the directory contents in the linux manpages is: CPP / C++ / C Code:
What I am trying to do is adapt the above manpage example to display the file names according to when they were last modified or accessed using the functions for time, stat alphasort and the same thing using compar. I think this is supposed to be done with scandir if I am not mistaken. Hope this clarifies my needs. Cheers, Old_Spen |
|
#4
|
||||
|
||||
|
Quote:
Quote:
2) Is this the same as your program? If not, we obviously can't tell you what you did wrong in your program. Quote:
Quote:
__________________
Age is unimportant -- except in cheese |
|
#5
|
|||
|
|||
|
Quote:
The man page code is: CPP / C++ / C Code:
t.c t scandir.c scandir gemgeh.c gemgeh fork1.c fork.c fork dsin1.c dsin.c dsin .. . **************************** My code to return directory contents based on time last modified is: CPP / C++ / C Code:
The error I get from my code is: Quote:
|
|
#6
|
|||
|
|||
|
As the message states, st_time isn't there because it doesn't need to be.
http://www.opengroup.org/onlinepubs/...ys/stat.h.html Code:
What compiler are you using? Its documentation ought to tell you what stuff is there. |
Recent GIDBlog
Developing GUIs with wxPython (Part 3) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The