看电脑是否别别人打开过

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
int main(){
    int fd;
    struct tm *now;
    char haha[50];
    time_t res;
    int cnt;
    fd=open("d:/log_info.txt",O_WRONLY|O_APPEND|O_CREAT);
    res=time(NULL);
    now=localtime(&res);
    printf("start time is: %s
",asctime(now));
    strcpy(haha,asctime(now));
    if((cnt=write(fd,haha,strlen(haha)))==-1){
        printf("wrong!!!!
");
    }
    else printf("cnt=%d
",cnt);
    return 0;
}
原文地址:https://www.cnblogs.com/symons1992/p/3480944.html