I am having problems while trying to communicate with the serial port. I have read many tutorials online and found all of them either to be not useful or just too complicated for the task which I must achieve.

The task is simple.
I want to:
1) Open a port (example "COM1")
2) Read and Write data from/to this port
3) Close the port

Preferably the data should be read in and wrote out simultaneously, as it will be controlling an external device in real time.
Any help or links to tutorials would be much appreciated.

Have you checked into Winsock 2? Their is really no way to handle data through a port, other then creating, and setting up a socket.(as far as i am aware) Even if all you are trying to do is very simple like you have explained, it still takes some effort to set the port up and for it to handle sending, and receiving data.

You use normal win32 api functions to do that. Read this

Open the com port with CreateFile. Scroll down the page to "Communications Resources" for more information. And an example c++ program.

Thanks for the quick reply.
I will check into Winsock 2 and see if it will help.

I have been trying to use the information at
http://msdn.microsoft.com/en-us/library/ms810467

But this uses Win32 and I really don't have much idea what I am doing.

Any code that I have gotten to work has been pages long using a lot of external libraries.

I have a program working a lot easier in C# using only a few lines of code but wanted to originally code in C++.

Coding anything in c++ is going to be more complicated than in other languages. c or c++ is not necessarily the best language for doing some things.

Thanks for the help everyone. Finally decided to give up on the C++ for this particular problem though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.