Click here to Skip to main content
15,924,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CallBack Function Pin
Ryan Binns13-Jul-03 22:51
Ryan Binns13-Jul-03 22:51 
General!strcmp Pin
DaveE9th13-Jul-03 19:37
DaveE9th13-Jul-03 19:37 
GeneralRe: !strcmp Pin
Tibor Blazko13-Jul-03 20:03
Tibor Blazko13-Jul-03 20:03 
GeneralRe: !strcmp Pin
Xander8013-Jul-03 20:10
Xander8013-Jul-03 20:10 
GeneralRe: !strcmp Pin
DaveE9th13-Jul-03 21:04
DaveE9th13-Jul-03 21:04 
GeneralRe: !strcmp Pin
Xander8013-Jul-03 21:35
Xander8013-Jul-03 21:35 
GeneralRe: !strcmp Pin
DaveE9th13-Jul-03 21:51
DaveE9th13-Jul-03 21:51 
GeneralRe: !strcmp Pin
Xander8013-Jul-03 22:54
Xander8013-Jul-03 22:54 
Again I'm sorry Sleepy | :zzz: Sleepy | :zzz: Sleepy | :zzz: (I must be sleeping).

When you compare 2 strings with strcmp(), this function returns 0, so strcmp("codeproject","codeproject") returns 0. That will result in if (!0). NOT 0 is 1, so when the 2 strings are identical, the result is displayed on screen with cout.

Check by watching the result var in the debugger:


<br />
int result = strcmp(str, Info[i]);<br />
<br />
if(!result)<br />
{<br />
	cout<<"\nInformation:"<<Info[i+1]<<"\n";<br />
	break;<br />
}


If result == 0 then the information is displayed.

Maybe it's better to rewrite the code to:


<br />
<br />
if (strcmp(str, Info[i])==0)<br />
{<br />
	cout<<"\nInformation:"<<Info[i+1]<<"\n";<br />
	break;<br />
}<br />
<br />


so it's perfectly clear that the if statement checks for identical strings (for less experienced programmers like me Unsure | :~ ).


WTF | :WTF: WTF | :WTF:
GeneralRe: !strcmp Pin
Ryan Binns13-Jul-03 23:13
Ryan Binns13-Jul-03 23:13 
GeneralRe: !strcmp Pin
Rob Caldecott13-Jul-03 23:17
Rob Caldecott13-Jul-03 23:17 
GeneralRe: !strcmp Pin
Ryan Binns13-Jul-03 23:22
Ryan Binns13-Jul-03 23:22 
GeneralRe: !strcmp Pin
DaveE9th13-Jul-03 23:29
DaveE9th13-Jul-03 23:29 
GeneralRe: !strcmp Pin
Ian Darling13-Jul-03 23:33
Ian Darling13-Jul-03 23:33 
Generalget mouse coordinate Pin
henli13-Jul-03 18:36
henli13-Jul-03 18:36 
GeneralRe: get mouse coordinate Pin
Nick Parker13-Jul-03 19:13
protectorNick Parker13-Jul-03 19:13 
GeneralRe: get mouse coordinate Pin
Ryan Binns13-Jul-03 22:53
Ryan Binns13-Jul-03 22:53 
Questionhow can i add toolbar to activex control?? Pin
logologologo13-Jul-03 16:48
logologologo13-Jul-03 16:48 
Generala vary hard question ---about using OpenDriver() Pin
gdzfy13-Jul-03 16:09
gdzfy13-Jul-03 16:09 
Questionwhat is the different between the the framewrok of the DLL and appliacation in vc++ Pin
gdzfy13-Jul-03 14:54
gdzfy13-Jul-03 14:54 
AnswerRe: what is the different between the the framewrok of the DLL and appliacation in vc++ Pin
John M. Drescher13-Jul-03 15:10
John M. Drescher13-Jul-03 15:10 
AnswerRe: what is the different between the the framewrok of the DLL and appliacation in vc++ Pin
John M. Drescher13-Jul-03 15:11
John M. Drescher13-Jul-03 15:11 
GeneralRe: what is the different between the the framewrok of the DLL and appliacation in vc++ Pin
gdzfy13-Jul-03 15:21
gdzfy13-Jul-03 15:21 
GeneralRe: what is the different between the the framewrok of the DLL and appliacation in vc++ Pin
John M. Drescher13-Jul-03 15:52
John M. Drescher13-Jul-03 15:52 
GeneralRe: what is the different between the the framewrok of the DLL and appliacation in vc++ Pin
gdzfy13-Jul-03 15:55
gdzfy13-Jul-03 15:55 
GeneralClickety Police Pin
John M. Drescher13-Jul-03 15:57
John M. Drescher13-Jul-03 15:57 

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.