Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <time.h>
  2. #include <stdio.h>
  3. #include <unistd.h>
  4.  
  5.  
  6. int main(){
  7. FILE * fp;
  8. while(1){
  9. time_t curtime;
  10. time(&curtime);
  11. printf("Current time = %s", ctime(&curtime));
  12. fp = fopen ("tmp/logfile.txt", "a");
  13. fprintf(fp, "%s", ctime(&curtime));
  14. fclose(fp);
  15. sleep(5);
  16. }
  17. return (0);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement