Simple question, how can i make myself sure that a "char something[somesize];, declared in its own block of {} will have its content totally flushed betweens calls for the functions? Heres what im talking about:
int SomeFunction(char TheParam) {
char ThatString[150];
sprintf(ThatString, "", 0); /I need to be sure that all the times this functions is called, ThatString = 0.
strcat(ThatString, TheParam);
SendMessage(hWndSomeControl, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) ThatString);
sprintf(ThatString, "", 0); //Clearing the string, is there any other way to do it?
sprintf(TheParam, "", 0); //Clearing the string, is there any other way to do it?
return 0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2002-12-05
declare as char ThatString[150] ="";
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nope, didnt do it. Doint it like you said, weird characters start to accumulate in the beginning of the string every time the Message is sent to the Control.
And with the sprintf(ThatString, "", 0); that does not happens :\
It sux :\ I have no problem with using this sprintf thing, but it gives me lots of gcc warnings...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Simple question, how can i make myself sure that a "char something[somesize];, declared in its own block of {} will have its content totally flushed betweens calls for the functions? Heres what im talking about:
int SomeFunction(char TheParam) {
char ThatString[150];
sprintf(ThatString, "", 0); /I need to be sure that all the times this functions is called, ThatString = 0.
strcat(ThatString, TheParam);
SendMessage(hWndSomeControl, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR) ThatString);
sprintf(ThatString, "", 0); //Clearing the string, is there any other way to do it?
sprintf(TheParam, "", 0); //Clearing the string, is there any other way to do it?
return 0;
}
declare as char ThatString[150] ="";
Nope, didnt do it. Doint it like you said, weird characters start to accumulate in the beginning of the string every time the Message is sent to the Control.
And with the sprintf(ThatString, "", 0); that does not happens :\
It sux :\ I have no problem with using this sprintf thing, but it gives me lots of gcc warnings...