Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <stdlib.h>
  4. int main(int argc, char * argv[]){
  5.  
  6. pid_t pid = 0;
  7. int i;
  8.  
  9. for(i = 0; i < strlen(argv[1]); i++){
  10. pid = fork();
  11. if(pid == 0) {
  12. printf("%c",argv[1] [strlen(argv[1]) - i - 1]);
  13. break;
  14. }
  15. else if (pid < 0) printf("%d",pid);
  16.  
  17. else usleep(10);
  18. }
  19. if(pid > 0) printf("\n");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement