Subj : Re: named pipe problem on linux To : comp.os.linux From : richard Date : Mon Nov 01 2004 04:49 pm Thanks, the flush made the C program work, but not C++ (which is what I am trying to use). I use g++ to compile both. ---- the C program works #include #include #include #include #include #define FIFO_FILE "MYFIFO" int main(void) { FILE *fp; char ch; /* Create the FIFO if it does not exist */ umask(0); mknod(FIFO_FILE, S_IFIFO|0666, 0); fp = fopen(FIFO_FILE, "r"); while( (ch=fgetc(fp)) != EOF ) { printf("Received char: %c\n", ch); fflush(stdout); } fclose(fp); return(0); } ------- the c++ program which donot work ------- #include #include #include #include #include #include #include #define FIFO_FILE "MYFIFO" int main(void) { char ch; /* Create the FIFO if it does not exist */ umask(0); mknod(FIFO_FILE, S_IFIFO|0666, 0); ifstream ifs(FIFO_FILE); while( ifs.good() ) { ifs.get(ch); printf("Received char: %c\n", ch); fflush(stdout); } return(0); } On Mon, 01 Nov 2004 09:01:54 +0100, Sybren Stuvel wrote: > ["Followup-To:" header set to comp.os.linux.] > richard enlightened us with: >> I have a simple test to pass information from a client to a server >> using named pipe. > > Using C. But posting to a C++ group. Make up your mind, but at least > don't crosspost. > >> anything I missed? > > Try flushing. > > Sybren .