Click to See Complete Forum and Search --> : newbie com port help


Techno
February 3rd, 2006, 09:15 AM
im new to this! :)

What I want to do is:

open com port
write to it
close it

and thats it! But I DO NOT wish to connect to a device - just simple beam useless data for example, without connecting.

I have VS.NET 2005/3, I dev in C#.
I also have embedded C++ 4.0

I am new to C++ so please help me understand some of the code you supply or examples :) I would greatly appreciate it!

In .NET 2.0 there is a new class called SerialPort. However I am having a problem when it writes to the port, it gives me a blank IOException.

Thought maybe would be best if i used EVC++ ?

please help!

Max Payne
February 5th, 2006, 07:46 PM
Using eVC++4.0, search MSDN for the following function to:

1 - open com port: CreateFile(...)
2 - write to it:WriteFile(..)
3 - close it : CloseHandle(..)

and maybe to read: ReadFile(...);

hope that helps.

Techno
February 5th, 2006, 07:50 PM
Thanks, I eventually got it but running into alot of problems at the minute.

here is the new thread:

http://www.codeguru.com/forum/showthread.php?t=374457

hopefully you can help