Advertisement
Geralt1001

Untitled

Feb 13th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. int getPidd()
  2. {
  3.     char target_pid[6];
  4.     char *endint;
  5.     int pid;
  6.     printf("Provide a PID:\n");
  7.     scanf("%6s",target_pid);
  8.    
  9.     pid=strtol(target_pid,&endint,10);
  10.     if(*endint || pid<=2 || pid==getpid())
  11.     {
  12.         printf("Incorrect PID!\n");
  13.         getPidd();
  14.     }
  15.     else
  16.         printf("PID: %d\n",pid);
  17.    
  18.     return pid;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement