All pastes #709727 Raw Edit

Something

public text v1 · immutable
#709727 ·published 2007-09-24 22:27 UTC
rendered paste body
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
 
int carga (char *arg[])
{
char lin_comand [50];
int i=1;
 
memset (lin_comand, '\0',sizeof(lin_comand));
memset (arg, '\0', sizeof(arg));
 
gets(lin_comand);
 
arg[0]=strdup(strtok(lin_comand," "));
 
while((arg[i] = (strtok(NULL ," " ))) != NULL)
 {
        arg[i] = strdup(arg[i]);
  i++;
}
 
/*printf("%s\n%d\n",arg[0],i); */
 return i;
}
 
 
 
int main()
{
char *arg[25];
int numcomand;
 
numcomand = carga(arg);
 
printf("%s\n%d\n",arg[2],numcomand);
 
return 0; 
}