Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <sys/types.h>
- #include <wait.h>
- int main(int argc, char *argv[])
- {
- pid_t p=0;
- struct data
- {
- int t;
- char c[100];
- }sv;
- FILE *f=fopen(argv[1],"r");
- if(f==NULL)
- {
- printf("Impossible open source of data\n");
- exit(1);
- }
- while(fscanf(f,"%d%s",&sv.t,sv.c)!=EOF)
- {
- p=fork();
- if(p==0)
- {
- sleep(sv.t);
- execv(sv.c,NULL);
- }
- }
- waitpid(p,NULL,0);
- fclose(f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement