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

Reply via email to