scope.c
来自「实时linux RTAI 下的如何使用RTFIFO代码」· C语言 代码 · 共 31 行
C
31 行
#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/mman.h>#include <sys/stat.h>#include <fcntl.h>#include <signal.h>static int end;static void endme(int dummy){ end=1;}int main(int argc, char * argv[]){ int fifo, counter; float sin_value; if ((fifo = open("/dev/rtf0", O_RDONLY)) < 0) { fprintf(stderr, "Error opening /dev/rtf0\n"); exit(1); } signal(SIGINT, endme); while (!end) { read(fifo, &counter, sizeof(counter)); read(fifo, &sin_value, sizeof(sin_value)); printf(" Counter : %d Seno : %f \n", counter, sin_value); } return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?