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 427,101 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,202 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: Programming Forums
Views: 340 | Replies: 3
Reply
Join Date: Apr 2008
Posts: 34
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: ★ ijug.net ★
Posts: 939
Reputation: ithelp will become famous soon enough ithelp will become famous soon enough 
Rep Power: 5
Solved Threads: 67
ithelp ithelp is offline Offline
Posting Shark

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: 11,197
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 Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 932
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

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 ?
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 713
Reputation: jephthah is a jewel in the rough jephthah is a jewel in the rough jephthah is a jewel in the rough 
Rep Power: 4
Solved Threads: 46
jephthah's Avatar
jephthah jephthah is offline Offline
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.
Why so serious?
Reply With Quote  
Reply

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

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

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

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