www.pudn.com > VC6GetCommPort.rar > main.cpp, change:2004-07-27,size:333b


#include "stdafx.h" 
#include <stdio.h> 
#include "enumser.h" 
 
 
void main() 
{ 
  CUIntArray ports; 
  EnumerateSerialPorts(ports); 
 
  _tprintf(_T("The following serial ports are installed on this machine\n")); 
  for (int i=0; i<ports.GetSize(); i++) 
  { 
    _tprintf(_T("COM%d\n"), ports.ElementAt(i)); 
  } 
  getchar(); 
}