Difference between revisions of "User talk:Davide.boldrin"

From Sistemi Operativi
Jump to navigation Jump to search
(Created page with "#include <stdio.h> #include <unistd.h> #include <errno.h> void invarg(int Qparametri, char* Rargv[], char* argv[]); int main(int argc, char* argv[]){ int Qparametri=argc-1;...")
 
(Blanked the page)
 
Line 1: Line 1:
#include <stdio.h>
 
#include <unistd.h>
 
#include <errno.h>
 
  
void invarg(int Qparametri, char* Rargv[], char* argv[]);
 
 
int main(int argc, char* argv[]){
 
int Qparametri=argc-1;
 
char *Rargv[Qparametri];
 
invarg(Qparametri, Rargv, argv);
 
printf("%s\n","il nuovo vettore dei parametri è stato creato con successo");
 
  execvp(Rargv[0], Rargv);
 
  perror("execvp");
 
  return 1;
 
 
}
 
 
void invarg(int Qparametri, char* Rargv[], char* argv[]){
 
Rargv[0]=argv[1];
 
Rargv[Qparametri]=NULL;
 
int i=2;
 
while(argv[i]!=NULL){
 
Rargv[Qparametri-1]=(argv[i]);
 
i++;
 
Qparametri--;
 
}
 
 
}
 

Latest revision as of 12:41, 26 November 2014