SHARE
TWEET

Untitled

a guest Jun 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top