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