blob: 274a81781b6a7d1db73c81a22908d48609c33b39 [file] [log] [blame]
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int argc, char **argv) {
int infd;
char buf[256];
int len, wlen;
int outfd = open("out", O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (outfd < 0) {
perror("open out");
return 1;
}
while (1) {
infd = open("/tmp/Fifo_bdt_tiaudio", O_RDONLY);
if (infd == -1) {
perror("open /tmp/Fifo_bdt_tiaudio");
return 1;
}
len = read(infd, buf, 256);
if (len != 0) {
printf("read %d bytes\n", len);
wlen = write(outfd, &buf, len);
if (len != wlen) {
printf("write error, wrote %d/%d\n", wlen, len);
}
}
close(infd);
}
return 0;
}