Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 21:55
Code-o-mat17-Jul-11 21:55 
GeneralRe: How to delete char Array-Memory leak detection Pin
Anu_Bala17-Jul-11 22:14
Anu_Bala17-Jul-11 22:14 
GeneralRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 22:31
Code-o-mat17-Jul-11 22:31 
GeneralRe: How to delete char Array-Memory leak detection Pin
Anu_Bala17-Jul-11 22:39
Anu_Bala17-Jul-11 22:39 
GeneralRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 22:47
Code-o-mat17-Jul-11 22:47 
GeneralRe: How to delete char Array-Memory leak detection Pin
Stefan_Lang20-Jul-11 1:21
Stefan_Lang20-Jul-11 1:21 
AnswerRe: How to delete char Array-Memory leak detection Pin
Albert Holguin18-Jul-11 5:31
professionalAlbert Holguin18-Jul-11 5:31 
QuestionHow to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 20:42
Le@rner17-Jul-11 20:42 
Hi all,

i am using CreateFile to open the port,its working fine when i am handle this with only single port.

but now i want to open multiple port at the same time and perform read/write operation on these ports.

In The open port method, it opens the first available port and when it gets the second it closes the opened one and then opens the next port and so on.

if (IsOpen())
  {
    //Close down the comms port
    BOOL bSuccess = CloseHandle(m_hComm);
    m_hComm = INVALID_HANDLE_VALUE;
    if (!bSuccess)
      TRACE(_T("Failed to close up the comms port, GetLastError:%d\n"), GetLastError());
  }
  
  //Free the event object we are using
  if (m_hEvent)
  {
    CloseHandle(m_hEvent);
    m_hEvent = NULL;
  }

//Call CreateFile to open up the comms port
  CString sPort;
  sPort.Format(_T("\\\\.\\COM%d"), nPort);
  m_hComm = CreateFile(sPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);


so please help me how can i do this.

thanks in advance.
AnswerRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 20:50
Code-o-mat17-Jul-11 20:50 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 20:56
Le@rner17-Jul-11 20:56 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 21:36
Code-o-mat17-Jul-11 21:36 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 21:38
Le@rner17-Jul-11 21:38 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 21:52
Code-o-mat17-Jul-11 21:52 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 22:05
Le@rner17-Jul-11 22:05 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 22:35
Code-o-mat17-Jul-11 22:35 
GeneralMessage Removed Pin
16-Dec-11 0:14
Le@rner16-Dec-11 0:14 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat16-Dec-11 0:29
Code-o-mat16-Dec-11 0:29 
Questionarray declaration Pin
Danzy8317-Jul-11 10:17
Danzy8317-Jul-11 10:17 
AnswerRe: array declaration Pin
Richard Andrew x6417-Jul-11 10:47
professionalRichard Andrew x6417-Jul-11 10:47 
GeneralRe: array declaration [modified] Pin
Danzy8317-Jul-11 11:56
Danzy8317-Jul-11 11:56 
GeneralRe: array declaration Pin
Richard Andrew x6417-Jul-11 13:45
professionalRichard Andrew x6417-Jul-11 13:45 
GeneralRe: array declaration Pin
Richard MacCutchan17-Jul-11 22:59
mveRichard MacCutchan17-Jul-11 22:59 
AnswerRe: array declaration Pin
«_Superman_»17-Jul-11 15:45
professional«_Superman_»17-Jul-11 15:45 
GeneralRe: array declaration Pin
Richard Andrew x6417-Jul-11 16:14
professionalRichard Andrew x6417-Jul-11 16:14 
GeneralRe: array declaration Pin
«_Superman_»17-Jul-11 16:33
professional«_Superman_»17-Jul-11 16:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.