| View previous topic :: View next topic |
| Author |
Message |
Jamil Guest
|
Posted: Tue Jan 20, 2004 3:36 am Post subject: C/C++ Sample code for Serial Communication |
|
|
I have a device connected through serial port of my desk top PC
running Windows 2000. The device is sending some data as serial stream
asynchronously. I need to do the follwings:
1) Open the COM1 port of the PC
2) Read the data coming from the connected device
3) Save the data into a file
4) After writing all the data, the COM1 port should be closed
Please refer me any sample code either in C or C++ which I could run
on Windows 2000 PC side for above tasks.
|
|
| Back to top |
|
 |
Jack Klein Guest
|
Posted: Tue Jan 20, 2004 4:41 am Post subject: Re: C/C++ Sample code for Serial Communication |
|
|
On 19 Jan 2004 19:36:26 -0800, [email]jamilur_rahman (AT) yahoo (DOT) com[/email] (Jamil) wrote
in comp.lang.c++:
| Quote: | I have a device connected through serial port of my desk top PC
running Windows 2000. The device is sending some data as serial stream
asynchronously. I need to do the follwings:
1) Open the COM1 port of the PC
2) Read the data coming from the connected device
3) Save the data into a file
4) After writing all the data, the COM1 port should be closed
Please refer me any sample code either in C or C++ which I could run
on Windows 2000 PC side for above tasks.
|
Sorry, but you can't do any of those things in standard C++, the topic
here. The C++ language (and the C language, for that matter) do not
define or support direct access to any hardware at all. All input and
output is defined in terms of C++ stream or C FILE objects.
You need to ask in a support group for your particular compiler to
find out what non-standard extensions it might provide to help with
this. It is a compiler and platform specific issue, not a language
one.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
|
|
| Back to top |
|
 |
Karl Heinz Buchegger Guest
|
Posted: Tue Jan 20, 2004 9:23 am Post subject: Re: C/C++ Sample code for Serial Communication |
|
|
Jamil wrote:
| Quote: |
I have a device connected through serial port of my desk top PC
running Windows 2000. The device is sending some data as serial stream
asynchronously. I need to do the follwings:
1) Open the COM1 port of the PC
2) Read the data coming from the connected device
3) Save the data into a file
4) After writing all the data, the COM1 port should be closed
Please refer me any sample code either in C or C++ which I could run
on Windows 2000 PC side for above tasks.
|
What's complicated about locating information on your own?
You have the world on you finger tips, you just need to find
the information:
http://www.google.com
Search string: serial port Win C++
--
Karl Heinz Buchegger
[email]kbuchegg (AT) gascad (DOT) at[/email]
|
|
| Back to top |
|
 |
thomas144 Guest
|
|
| Back to top |
|
 |
|