Created
December 8, 2021 11:00
-
-
Save mikhailnov/e5a93ca73420473130c38169b5f2b138 to your computer and use it in GitHub Desktop.
Wait until a file appears in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
int main(){ | |
for(;;){ | |
if (access("/tmp/xxx", F_OK) == 0) { | |
printf("%s", "File exists\n"); | |
break; | |
} else { | |
sleep(1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment