Re: File Question.
"Valnir" <[email protected]> Tue, 15 Aug 2006 08:09:57 -0400
| Newsgroups | gmane.games.devel.mud.rom |
|---|---|
| Message-ID | <[email protected]> |
Thanks Michael, exactly what I needed. Also saved opening the file first. Much appreciated! - Valnir ----- Original Message ----- From: "Michael Barton" <[email protected]> To: <[email protected]> Sent: Monday, August 14, 2006 1:16 PM Subject: Re: File Question. > The function you're looking for is stat(2). > > #include <sys/types.h> > #include <sys/stat.h> > #include <unistd.h> > #include <stdio.h> > int main(int argc, char **argv) > { > struct stat buf; > stat("filename", &buf); > printf("%s\n", ctime(&buf.st_mtime)); > } > > If you already have a FILE * open for the file, you can use the > fstat(2) function along with fileno(3) function instead of stat(2), so > you don't need the name of the file. > > On 8/14/06, Valnir <[email protected]> wrote: >> Ok, this one's got me a little nuts. Especially since I'm sure it's >> something easy. How do you find the "last modified" date of a file? I'm >> trying to do a build revision using the modified date, so players can see >> when the last change was made and see that stuff does get changed and >> updated. I'm trying to do it from the FILE object, but if I'm completely >> wrong or you have a better suggestion, let me know. >> >> Thanks! >> - Valnir >> >> -- >> ROM mailing list >> [email protected] >> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom >> > -- > ROM mailing list > [email protected] > Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom > -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom