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