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)
}
프로그램은 처음에는 들어 가지 않는다. 그것은 전에 모든 컨트롤을하고 그 터미널은 아무 것도 보여주지 않는다. 왜 나 한테 도움이되는지 모르겠다.
어디서 초기화합니까? – kunal
---- 변수의 정의 ---- 나는 이렇게한다 : bool contr1 = true; –
pathServer = argv [1]; 무엇입니까? pathClient = argv [2]; – kunal