![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete the last modified file | kingofprussia | UNIX for Dummies Questions & Answers | 1 | 06-04-2008 01:37 PM |
| how to retrieve original contents of a modified file (modified using vi) | novice100 | UNIX for Dummies Questions & Answers | 3 | 05-31-2007 05:50 PM |
| ftp most recently modified file | ahmedwaseem2000 | Shell Programming and Scripting | 6 | 02-27-2007 10:22 AM |
| who modified my file!! | mohanprabu | UNIX for Dummies Questions & Answers | 4 | 10-28-2005 07:18 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
File last modified
I cannot read the last moment
the file was modified - it returns "Most recent access" instead: code: </td> <th><?FILE *fatr=fopen(iindname.c_str(), "r"); if(fatr){ struct stat statbuf; fstat(fileno(fatr), &statbuf); fclose(fatr); ?> <?if(statbuf.st_size>1024)cout<<(statbuf.st_size/1024)<<" K"; else cout << statbuf.st_size?> </th><th> <? if (statbuf.st_mode & S_IREAD){?> r <?} if (statbuf.st_mode & S_IWRITE){?> w <?}?> </th><th> <b><?=ctime(&statbuf.st_ctime)?></b> Is there any other (more sure) method to do this in C/C++? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I'm not sure what that gibberish is. Some sort of scripting language based on c++?
But try using st_mtime instead of st_ctime. |
|
#3
|
|||
|
|||
|
Quote:
to real C++ and compiled by common g++ - see preprocessor here - now I try to crossplatform it Quote:
have the same values! What can be a problem? OS is Linux RH9. |
|
#4
|
||||
|
||||
|
Use the ls command on the file in question.
ls -l file # show mtime ls -lc file # show ctime ls -lu file # show atime |
|
#5
|
|||
|
|||
|
Works!
Thank you! |
|||
| Google The UNIX and Linux Forums |