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

Last change on this file since 10911 was 10911, checked in by stuerze, 8 days ago

minor changes to solve an issue under windows operation system

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