Click here to Skip to main content
15,886,769 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anyone know of a simple way to get a list of all the available (installed) serial ports on a machine? I'm looking for a way to do this in C. I know that in C# it's a trivial matter to get the list, but I need a method to work in plain old C.

Anyone want to help?
Posted

1 solution

This link[^] includes a number of methods of enumerating serial ports (or other things masquerading as such). Some of these should be accessible from "plain old" C - just look for the underlying Win API calls.

Good luck!

ps One Vista gotcha I found, is that to access COM10 to COM255 (i.e. >1 digit numbers), you need Administrator rights to use the "\\.\COMnn" form. This form is required (at least on XP and later) to access anything after COM9. Don't know about Weven, but judging from M$s non-response to my bug report, I'd guess it behaves like Vista.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900