- Code: Select all
int main(int argc, char** argv)
if ((fd = open(argv,O_RDWR|O_APPEND|O_CREAT, 0777)) <0 )
char* hm = asctime(localtime(<ime));
write(fd,hm,sizeof(char)); //<- Only appends 3 first letters.
printf("%s",asctime(localtime(<ime))); //<- Works fine.
Run with "./time test.txt"
The above is what I've done and quite honestly I've found a bunch of info on how to display time etc, but minimal on how to output that data onto a file.
Thanks in advance.