Solved

open the COM1 port

Posted on 1998-01-07
1
554 Views
Last Modified: 2008-02-01
Dear sir,
 How can I open the COM1 port to read the characters  through it by using Visual C++ 5.0?
Thanks,
0
Comment
Question by:myle
1 Comment
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1177739
Com port is treated as file in Win32. So use CerateFile Win32 API function to open file and ReadFile and WriteFile to read/write data from/to port.

  HANDLE hPort = ::CreateFile
  ( _T("COM1"),
            GENERIC_READ | GENERIC_WRITE,
            0,    // exclusive access                
            NULL, // no security attributes
            OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL,
            NULL  // No template
  );
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now