hello
can any one give me a simple examle code to read and write to serial port?
i want to send data to the port and recevie the same.
i use visual c++

There is no such thing as "simple" example. You have to use win32 api Communications Functions. After calling CreateFile() to open the serial port you will have to fill out a DCB structure, then call BuildCommDCB(). After than you call ReadFile() and WriteFile() to read/write to the port. Here is a c++ class that you might want to study

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.