Hello, brand new to this board and requesting a little help. Have never learned C language but took a number of C++ courses a few years back [5-6 yrs ago]. Current job has me debugging/enhancing some C code and I can't figure this out.
Here's the issue: I am trying to put some logging statements in an If Else statement so that I can see which condition is true. When I place logging in the Else portion of the statement, I am getting this error when compiling:
error C2181: illegal else without matching if
Here's the code I'm working with:
Code:
// If # sign then GbCifSecurity = TRUE and return TRUE
if ((strcmp(acVastBuf, "CHREND1#") == 0) ||
(strcmp(acVastBuf, "CHREND2#") == 0) ||
(strcmp(acVastBuf, "CHREND3#") == 0) ||
(strcmp(acVastBuf, "CHREND01") == 0) ||
(strcmp(acVastBuf, "CHREND02") == 0) ||
(strcmp(acVastBuf, "CHREND03") == 0) ||
(strcmp(acVastBuf, "SUPTPGR#") == 0))
GbCEPSecurity = TRUE;
// Testing debug statement
ShLogOpen("H:\\CharitableBlocking.log");
ShLogWrite("_CINSRCH", "Charitable Blocking - Yes it's in list.");
ShLogClose();
else
// Testing debug statement
ShLogOpen("H:\\CharitableBlocking.log");
ShLogWrite("_CINSRCH", "Charitable Blocking - No it's not in list.");
ShLogClose();
GbCEPSecurity = FALSE;
}