source: ntrip/trunk/BNC/src/test_serial.cpp@ 9952

Last change on this file since 9952 was 9952, checked in by stuerze, 17 months ago
File size: 396 bytes
Line 
1
2#ifndef WIN32
3#include <unistd.h>
4#elif
5#include <qt_windows.h>
6#endif
7#include <stdio.h>
8#include <stdlib.h>
9
10int main(int argc, char* argv[]) {
11
12 FILE* fp = fopen("/dev/ttyS0", "r");
13
14 if (!fp) {
15 printf("Cannot open file.\n");
16 exit(9);
17 }
18
19 char msg[100];
20
21 while (true) {
22 int nb = fread(msg, sizeof(msg), 1, fp);
23 printf("read %d\n", nb);
24 sleep(1);
25 }
26
27 return 0;
28}
Note: See TracBrowser for help on using the repository browser.