Files
c-programmering-tredje-utgavan/kapitel17/fifo-client-ex1.c
2021-10-01 20:24:05 +02:00

21 lines
368 B
C

#include <stdio.h>
#include <unistd.h>
#define FIFONAM "/tmp/testfifo"
int main(void)
{
FILE *fp;
signed char c;
if ( access(FIFONAM, R_OK) != 0 )
{
fprintf(stderr, "Problem att öppna %s\n", FIFONAM);
return 1;
}
fp = fopen(FIFONAM, "r");
while ((c = getc(fp)) != EOF)
putchar(c);
fclose(fp);
return 0;
}