Dec 31, 2014 at 3:08pm UTC
Here is a code of Connect(void) in class Rs232.
1 2 3 4 5 6 7 8 9 10 11
BOOL Rs232::Connect(void )
{
if ( m_hComm != NULL )
CloseCommPort();
if ( !OpenCommPort())
return FALSE;
return TRUE;
}
If in the main function I use a code as follows:
1 2
Rs232 Rs;
Rs.Connect(void );
Does this mean that the function OpenCommPort()will be executed?
( it means that Rs.OpenCommPort() will be executed and it will do communication configuration setting)
Last edited on Dec 31, 2014 at 3:08pm UTC
Jan 3, 2015 at 5:49am UTC
When Connect(void) is called, this means the function OpenCommPort() will also be called and executed?
And assume that in the OpenCommPort() all communication setting is set and after Connect(void) is done the communication setting still remained?
Is the Connect(void) above same as OpenCommPort()?
I see no difference.
All what it does is:
If the comm port is open then closes it, then open it again.
If the comm port is not open then opens it.
So all what it does is open comm port.