Win98:Serial Communications Functions,Classes, etc.

I am in need of a basic set of serial port functions to send/receive data from the com ports.  I have looked through many books and have only found MSComm, the Active X control, and a few other incomplete libraries.  I would be satisfied with MSComm (I believe) if I could find some C++ documentation on it (all I find is VB).  SO:  I am looking for a good serial solution.  The soln must have basic readChar, writeChar, readBlock, writeBlock functionality.  That's it.  No error checking or anything else.  Any ideas?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi SoundsFishy,

Here is some code I'm use myself. It is simple and has not much error checking.

May be I should wrap it in some class ones.

HANDLE hComHandle;

hComHandle = CreateFile ("\\\\.\\COM1", GENERIC_READ | GENERIC_WRITE,

 DCB dcb;
// Initialise serial communication
 if (GetCommState(hComHandle, &dcb))
// Set the serial communicaton options
  dcb.BaudRate      = CBR_9600;
  dcb.Parity      = NOPARITY;
  dcb.ByteSize      = 8;
  dcb.StopBits      = ONESTOPBIT;

  if (!SetCommState(hComHandle, &dcb))
// Now you can use the ReadFile and WriteFile function as if hComHandle is a normal file.

It should work for the paralel port also.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Take a look at ("Serial Communications in Win32") - this article describes in-depth how to use COM ports.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.