/*
*将从FIFO收到到数据(字符)转换为大写,并输出到屏幕
*/
#include "common.h"
int main()
{
int ret;
int fd;
char buffer;
int nread;
int i;
/*建立FIFO*/
ret = mkfifo(FIFO_PATH, 0777);
/*打开FIFO*/
fd = open(FIFO_PATH, O_RDONLY);
if(-1 == fd)
{
printf("error\n");
return -1;
}
while(1)
{
nread = read(fd, &buffer, 1);
if(nread > 0)
{
buffer = toupper(buffer);
printf("%c", buffer);
}
}
}
- 1
- 2
前往页