Lock file
// for file descriptor int fd = open(...); if(qFileLock(fd) == true) { (...atomic file access...) qFileUnlock(fd); } // for FILE stream object FILE *fp = fopen(...); int fd = fileno(fp); if(qFileLock(fd) == true) { (...atomic file access...) qFileUnlock(fd); }
|