1
votes

I'm running Windows 7 and using Visual Studio 2012 RC. I have a USB device connected to my COM6 port, and the device is streaming ASCII output. I want to grab that data to use in my program, which I'm writing in C++. I'm pretty new to programming in general, so I'm sort of lost. I know I have to use a certain library, and I saw the function CreateFile being used, but I just can't seem to get it to work. Any help would be much obliged, thank you.

Edit: I'm able to open the port and retrieve its basic data: I can print out the baud rate, bit size, parity, and stop bits values. But I need to retrieve the streaming ASCII data, which is where I'm lost. Sorry for not clarifying.

2
What did you try? Note that the device name is written like this: CreateFile("\\\\.\\COM6", .... See here - huysentruitw
BTW, if you're new to programming, I would not start with these kind of things, you'll need to start a thread, use ReadFile, parse ASCII lines, and synchronize between other threads. This is not a "Hello World" we're talking about :) - huysentruitw
I'm able to open the port and read its settings - I can see the baudrate, bytesize, parity, and stopbits values. I just need to see the ASCII data it's suppose to be streaming now. - Robert Joseph Dacunto
Yes, they still exist in the form of USB-to-Serial converters that use virtual COM ports: amazon.com/TRENDnet-RS-232-Serial-Converter-TU-S9/dp/B0007T27H8 - sizzle
Yes, that's exactly what I'm using. Sorry for not clarifying that. - Robert Joseph Dacunto

2 Answers

0
votes
0
votes

I suggest you use a complete library that is well tested. Here is the one I use:

http://www.eltima.com/products/serial-activex/