Skip to content

Instantly share code, notes, and snippets.

@mikhailnov
Created December 8, 2021 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikhailnov/e5a93ca73420473130c38169b5f2b138 to your computer and use it in GitHub Desktop.
Save mikhailnov/e5a93ca73420473130c38169b5f2b138 to your computer and use it in GitHub Desktop.
Wait until a file appears in C
#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