source:
ntrip/trunk/BNC/test_serial.cpp@
1618
| Last change on this file since 1618 was 1608, checked in by , 17 years ago | |
|---|---|
| File size: 379 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 | ||
| 8 | FILE* fp = fopen("/dev/ttyS0", "w"); | |
| 9 | ||
| 10 | if (!fp) { | |
| 11 | printf("Cannot open file.\n"); | |
| 12 | exit(1); | |
| 13 | } | |
| 14 | ||
| 15 | const char* msg = "message\n"; | |
| 16 | ||
| 17 | while (true) { | |
| 18 | int nb = fprintf(fp, msg, sizeof(msg)); | |
| 19 | fflush(fp); | |
| 20 | printf("written %d\n", nb); | |
| 21 | sleep(1); | |
| 22 | } | |
| 23 | ||
| 24 | return 0; | |
| 25 | } |
Note:
See TracBrowser
for help on using the repository browser.
