[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: serial ports
- From: Fontana Nicola <ntd users sourceforge net>
- To: gtk-app-devel-list gnome org
- Subject: Re: serial ports
- Date: Tue, 15 May 2007 14:06:59 +0200
On Monday 14 May 2007 20:49, Pavel A. da Mek wrote:
> When I want to use serial ports, shall I write separate code for Windows
> and for Linux, or is there some library function which would allow to do it
> in the platform independent way?
I hit the same problem in 2004, and I wrote an abstraction layer and 2
different implementations. Basically, I implemented open(), close(), read()
and write() using termios.h in linux and the Windows API (CreateFile(),
ReadFile(), WriteFile() ...) in windows. read() and write() are implemented
in a blocking way, because I'm used to put all the dialing stuff in a
separate thread.
If you want, I can send you the relevant code: be carefull, it is a beautiful
example of bad C C++ mixing.
-- Nicola
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]