C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

C/C++ Sample code for Serial Communication

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Jamil
Guest





PostPosted: Tue Jan 20, 2004 3:36 am    Post subject: C/C++ Sample code for Serial Communication Reply with 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.
Back to top
Jack Klein
Guest





PostPosted: Tue Jan 20, 2004 4:41 am    Post subject: Re: C/C++ Sample code for Serial Communication Reply with quote



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





PostPosted: Tue Jan 20, 2004 9:23 am    Post subject: Re: C/C++ Sample code for Serial Communication Reply with quote



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





PostPosted: Mon Feb 16, 2004 9:54 pm    Post subject: Re: C/C++ Sample code for Serial Communication Reply with quote

Quote:
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

Karl,

I did a google search on "serial communication c++ sample code" and it found this thread.

I found this fairly useful site:
http://www.wince.org.uk/vc/intermediate/serialrw.htm

as well as (even better I think):

http://www.codeproject.com/system/serial.asp





Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.