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