Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SDL window in MFC application. [modified] Pin
toxcct1-Jun-06 6:19
toxcct1-Jun-06 6:19 
GeneralRe: SDL window in MFC application. Pin
David Crow1-Jun-06 7:21
David Crow1-Jun-06 7:21 
GeneralRe: SDL window in MFC application. Pin
toxcct1-Jun-06 7:24
toxcct1-Jun-06 7:24 
GeneralRe: SDL window in MFC application. Pin
ThatsAlok1-Jun-06 19:12
ThatsAlok1-Jun-06 19:12 
QuestionCString/strcpy error Pin
kitty51-Jun-06 5:07
kitty51-Jun-06 5:07 
AnswerRe: CString/strcpy error [modified] Pin
Viorel.1-Jun-06 5:15
Viorel.1-Jun-06 5:15 
AnswerRe: CString/strcpy error Pin
Karthickg1-Jun-06 5:18
Karthickg1-Jun-06 5:18 
AnswerRe: CString/strcpy error Pin
Zac Howland1-Jun-06 5:41
Zac Howland1-Jun-06 5:41 
kitty5 wrote:
for(int index = 0; index < (sentence.GetLength()); index++)
{
if(sentence[index] == num)
strcpy( (sentence[index]), spc); //line 55
}


The above code is VERY VERY bad! Unfortunately, your compiler won't tell you exactly how bad it is, but I'll give you an alternative:

Replace the entire for-loop with the following:
sentence.Replace(spc, _T(' '));

A better solution would be to re-write the entire function to the following:
<br />
int main ()<br />
{<br />
  CString sentence;<br />
  sentence.Format("1  2.1  ");<br />
  printf("%s \n", (const char*)sentence);<br />
  return 0;<br />
}<br />


If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
GeneralRe: CString/strcpy error Pin
kitty51-Jun-06 5:57
kitty51-Jun-06 5:57 
GeneralRe: CString/strcpy error Pin
Zac Howland1-Jun-06 6:06
Zac Howland1-Jun-06 6:06 
GeneralRe: CString/strcpy error Pin
David Crow1-Jun-06 8:49
David Crow1-Jun-06 8:49 
QuestionMSHflexgrid hide column question Pin
Tarek Jabri1-Jun-06 5:05
Tarek Jabri1-Jun-06 5:05 
QuestionCapturing a Windows event Pin
Grimes1-Jun-06 4:58
Grimes1-Jun-06 4:58 
AnswerRe: Capturing a Windows event Pin
Hamid_RT1-Jun-06 5:58
Hamid_RT1-Jun-06 5:58 
GeneralRe: Capturing a Windows event Pin
Grimes2-Jun-06 9:28
Grimes2-Jun-06 9:28 
QuestionHow to use Tokenize() wid CStrings in VC6 Pin
Cyber Friend1-Jun-06 4:55
Cyber Friend1-Jun-06 4:55 
AnswerRe: How to use Tokenize() wid CStrings in VC6 Pin
Viorel.1-Jun-06 5:21
Viorel.1-Jun-06 5:21 
AnswerRe: How to use Tokenize() wid CStrings in VC6 Pin
Michael Dunn1-Jun-06 6:56
sitebuilderMichael Dunn1-Jun-06 6:56 
AnswerRe: How to use Tokenize() wid CStrings in VC6 Pin
pgibson0077001-Jun-06 10:33
pgibson0077001-Jun-06 10:33 
QuestionFillRect with CBrush question Pin
LukeV1-Jun-06 3:58
LukeV1-Jun-06 3:58 
AnswerRe: FillRect with CBrush question Pin
Viorel.1-Jun-06 4:11
Viorel.1-Jun-06 4:11 
GeneralRe: FillRect with CBrush question Pin
LukeV1-Jun-06 4:37
LukeV1-Jun-06 4:37 
AnswerRe: FillRect with CBrush question Pin
Sarath C1-Jun-06 4:35
Sarath C1-Jun-06 4:35 
QuestionI HATE ADO - newbie Pin
antonaras1-Jun-06 3:47
antonaras1-Jun-06 3:47 
AnswerRe: I HATE ADO - newbie Pin
Viorel.1-Jun-06 3:51
Viorel.1-Jun-06 3:51 

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.