Advertisement
Jobjob

OS Examen Janvier 2012 Q1

Dec 24th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.     int pid = fork();
  5.     if(pid == 0){ //le fils
  6.         system("find ./ -mindepth 2 -maxdepth 2 | wc -l > /tmp/compte.data");
  7.     } else{ //le pere
  8.         system("ps -f");
  9.         wait(&pid);
  10.         system("x=$(cat /tmp/compte.data);echo Le nombre de fichiers dans les sous répertoires du répertoire courant est de: $x fichiers.");
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement