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

Last change on this file since 9955 was 9955, checked in by stuerze, 15 months ago

minor changes

File size: 413 bytes
RevLine 
[1608]1
[9952]2#ifndef WIN32
[1608]3#include <unistd.h>
[9954]4#else
[9955]5#include <windows.h>
6#include <direct.h>
[9952]7#endif
[1608]8#include <stdio.h>
9#include <stdlib.h>
10
11int main(int argc, char* argv[]) {
12
[1633]13 FILE* fp = fopen("/dev/ttyS0", "r");
[1608]14
15 if (!fp) {
16 printf("Cannot open file.\n");
[9854]17 exit(9);
[1608]18 }
19
[1633]20 char msg[100];
[1608]21
22 while (true) {
[1633]23 int nb = fread(msg, sizeof(msg), 1, fp);
24 printf("read %d\n", nb);
[1608]25 sleep(1);
26 }
27
28 return 0;
29}
Note: See TracBrowser for help on using the repository browser.