[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

error al compilar



Al compilar esto en mi maquina me da error

gcc -c CLIENTE.C -o cliente
CLIENTE.C: In function `int main(int, char **)':
CLIENTE.C:24: implicit declaration of function `int atoi(...)'

Compilation exited abnormally with code 1 at Tue Dec 23 12:29:05

En cambio en la máquina de otro funciona bien,  es problema de mi compilador 
??

# include <stdio.h>
# include <errno.h>
# include <unistd.h>
# include <string.h>
# include <fcntl.h>

void panic (char *miss){
	fprintf(stderr, "%s %s\n",miss,strerror(errno));
	exit(-1);
}

int main(int argc, char* argv[])
{
  int n, fd, envio, recept;
  char str[256];
  char c;

  if(argc !=3 ) panic ("error argumentos incorrectos clente");


  fd = open("./client/result_comanda",O_WRONLY|O_CREAT|O_APPEND,0644);
  if (fd<0)panic("error abriendo fichero result_comanda");
   envio = atoi(argv[1]);
  recept = atoi(argv[2]);
  //do{
	printf("ya puede introducir los comandos que desea ejecutar\n");
	scanf("%s", str);
        read(0, &str, strlen(str));
	write (envio,&str,strlen(str));
	printf("COMANDO ENVIADO\n");

	while(read(recept,&c,sizeof(char))>0){
		write(1,&c,sizeof(char));
		write(fd,&c,sizeof(char));
	}
	printf("respuesta recibida\n");

  //}while(strcmp(str,"exit")!= 0 );
  close(envio);
  close(recept);
  close(fd);

}

---Publicidad--------------------------------------------------------
Únete a los miles de sin pareja en Meetic... ¡te vas a enamorar!
http://www.iespana.es/_reloc/email.meetic



Reply to: