Skip to content

A simple C++ class for enumerating COM ports on a computer.

License

Notifications You must be signed in to change notification settings

nkinar/GetComPortList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GetComPortList

A simple C++ class for enumerating COM ports on a computer. Useful for embedded programming or for communication with USB-to-serial bridge devices.

Example Windows Run

Example Max OS X Run

Example Linux Run

Motivation

This C++ class provides cross-platform enumeration of serial ports for Windows, Linux and Mac OS X.

Getting Started

Uses the C++17 standard library.

Example Usage

Please see the main.cpp file for further details. A complete sample program is provided below.

#include <iostream>
#include "GetComPortList.h"

int main()
{
	std::cout << "Print all serial port names:" << std::endl;
	GetComPortList::print_serial_port_list();
	std::cout << "Obtain a vector of port names:" << std::endl;
	std::vector<std::string> lst = GetComPortList::get_list_serial_ports();
	for (const std::string& s: lst)
	{
		std::cout << s << std::endl;
	}
	return 0;

} // end

Documentation

This readme file and C++ class should be easily understandable. Please feel free to contact me if you would like to have changes made to the code.

Authors

  • Nicholas J. Kinar

About

A simple C++ class for enumerating COM ports on a computer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published