User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 363,381 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,864 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 258 | Replies: 3
Reply
Join Date: Apr 2008
Posts: 33
Reputation: toolbox03 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
toolbox03 toolbox03 is offline Offline
Light Poster

Timestamp

  #1  
May 14th, 2008
How do i print timestamp to a text file? any sample codes?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: homeworkhelp.co.in
Posts: 790
Reputation: ithelp is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 59
ithelp ithelp is offline Offline
Master Poster

Re: Timestamp

  #2  
May 14th, 2008
You may check time.h for api defintions.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 9,908
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 32
Solved Threads: 793
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Posting Prodigy

Re: Timestamp

  #3  
May 14th, 2008
All files are automatically time stamped by the file system when saved or changed. So what else do you want to do with it ?
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 666
Reputation: jephthah has a spectacular aura about jephthah has a spectacular aura about jephthah has a spectacular aura about 
Rep Power: 4
Solved Threads: 42
jephthah's Avatar
jephthah jephthah is offline Offline
Practically a Master Poster

Re: Timestamp

  #4  
May 14th, 2008
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int main ()
  5. {
  6. time_t unixTime;
  7. FILE * fp;
  8. char stamp[32];
  9.  
  10. unixTime = time (NULL);
  11. fprintf (stamp,"timestamp: %ld\n", unixTime);
  12. if (fp = fopen("myfile.txt","a"))
  13. {
  14. fputs(stamp,fp);
  15. fclose(fp);
  16. }
  17. return 0;
  18. }


f you want to know what "unix time" is and how you can make it more meaningful to the average person... look up "time.h"


.
Last edited by jephthah : May 14th, 2008 at 5:40 pm.
I drink your milkshake.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 12:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC