2016-06-01 1 views
0

약간의 문제가 있습니다. 나는이 코드를 가지고있다while not recognized (시스템 호출 -c)

#include <stdio.h> 
#include <string.h> 
#include <stdlib.h> 
#include <unistd.h> 
#include <sys/stat.h> // serve per le FIFO 
#include <fcntl.h> // serve per la open 
#include <stdbool.h> 
#define BUF_SIZE 100 

int main (int argc,char *argv[]){ 

----definition of variables---- 

if (argc > 3) { 
    printf("Errore troppi argomenti da riga di start\n"); 
    return -1; 
} 

if (argc < 2) { 
    printf("Errore pochi argomenti da riga di start\n"); 
    return -1; 
} 

if(argc == 3){ 
    pathServer=argv[1]; 
    pathClient=argv[2]; 
    printf("Ho stampato da riga di comando %d parametri.\n", argc); 
} 

if(argc == 2){ 
    pathServer=argv[1]; 
    printf("Ho stampato da riga di comando %d parametri.\n", argc); 
} 

if((mkfifo(pathClient, S_IWUSR | S_IRUSR)) < 0){ 
printf("Errore. FifoClient non creata.\n"); 
return -1; 
} 

fifoServer=open(pathServer, O_WRONLY); 
write(fifoServer, pathClient, strlen(pathClient)); 
fifoClient=open(pathClient, O_RDONLY); 

while(contr1) { 
    printf ("Inserisci comando da eseguire:\n"); 
(other code) 
} 

프로그램은 처음에는 들어 가지 않는다. 그것은 전에 모든 컨트롤을하고 그 터미널은 아무 것도 보여주지 않는다. 왜 나 한테 도움이되는지 모르겠다.

+0

어디서 초기화합니까? – kunal

+0

---- 변수의 정의 ---- 나는 이렇게한다 : bool contr1 = true; –

+0

pathServer = argv [1]; 무엇입니까? pathClient = argv [2]; – kunal

답변

0

우리가 대답 할 수 있기 전에 조금 문제를 명확히 밝혀주십시오.

처음으로 if 또는 첫 번째 while을 인식하지 못하겠습니까? while을 의미하는 경우 변수 contr1에 대한 조언을 제공하십시오. 어디서 오는거야? 그 가치를 바꾸는 것은 무엇입니까?