Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

MSDN function CreateFileA all-ways gives the same handle for different UART COM Inetrfaces

$
0
0

Hi All,

I have question about opening a comport connection with UART interface.I am using the MSDN functionCreateFileA to open a connection with UART interface but it is always giving with same handle.I have tried with few known options available with function but no matter what, it always returns the same handle (even for a different comports).

BTW, I am using the below code to open the comport interface:

       // Open COM port

       if ((comport =

              CreateFileA(commName,                // open com5:

              GENERIC_READ | GENERIC_WRITE, // for reading and writing

              FILE_SHARE_READ | FILE_SHARE_WRITE, // shared access

              NULL,                         // no security attributes

              OPEN_EXISTING,             

              FILE_FLAG_OVERLAPPED | FILE_ATTRIBUTE_NORMAL |  FILE_FLAG_NO_BUFFERING,

              NULL)) == INVALID_HANDLE_VALUE)

       {

              return status_invalid;

       }

As Iwant to open UART interfaces for different comports,I need different handles to interact with different comports. Can you please giveme suggestion to fix our problem?

 Thanks,

Srinu



Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>