Bonjour
je voulais stocker sur un tableau de char** cmd;
une commande entrée au clavier genre cat test.txt
j'ai utilisé strtok mais j'ai un probleme de segmentation je vous montre le code:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#define TAILLE 120
char retour[TAILLE];
char* getcommande()
{
fgets(retour,TAILLE,stdin);
return retour;
}
char* DecouperCommande(char* retour)
{
char* c;
c=strtok(retour," ");
while(c=strtok(NULL," "))
{
return c;
}
}
int main()
{
int i=0;
char* recup_retour,recup;
printf("My shell\t");
recup_retour=getcommande();
printf("recup=%s",recup_retour);
return 0;
}
