Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Library Usage Problem Pin
MicroVirus16-Sep-11 4:40
MicroVirus16-Sep-11 4:40 
GeneralRe: Library Usage Problem Pin
Erudite_Eric16-Sep-11 4:49
Erudite_Eric16-Sep-11 4:49 
GeneralRe: Library Usage Problem Pin
MicroVirus16-Sep-11 12:16
MicroVirus16-Sep-11 12:16 
AnswerRe: Library Usage Problem Pin
Richard MacCutchan14-Sep-11 23:36
mveRichard MacCutchan14-Sep-11 23:36 
GeneralRe: Library Usage Problem Pin
Albert Holguin16-Sep-11 4:03
professionalAlbert Holguin16-Sep-11 4:03 
GeneralRe: Library Usage Problem Pin
Richard MacCutchan16-Sep-11 5:24
mveRichard MacCutchan16-Sep-11 5:24 
GeneralRe: Library Usage Problem Pin
Albert Holguin16-Sep-11 5:58
professionalAlbert Holguin16-Sep-11 5:58 
AnswerRe: Library Usage Problem Pin
Chris Meech15-Sep-11 8:18
Chris Meech15-Sep-11 8:18 
QuestionDesign of Application Pin
002comp14-Sep-11 23:04
002comp14-Sep-11 23:04 
AnswerRe: Design of Application Pin
Richard MacCutchan15-Sep-11 0:15
mveRichard MacCutchan15-Sep-11 0:15 
GeneralRe: Design of Application Pin
002comp15-Sep-11 0:27
002comp15-Sep-11 0:27 
GeneralRe: Design of Application Pin
Richard MacCutchan15-Sep-11 0:35
mveRichard MacCutchan15-Sep-11 0:35 
QuestionCRichCtrl Pin
john563214-Sep-11 22:02
john563214-Sep-11 22:02 
AnswerRe: CRichCtrl Pin
Richard MacCutchan14-Sep-11 22:21
mveRichard MacCutchan14-Sep-11 22:21 
GeneralRe: CRichCtrl Pin
john563214-Sep-11 22:45
john563214-Sep-11 22:45 
GeneralRe: CRichCtrl Pin
Richard MacCutchan14-Sep-11 23:25
mveRichard MacCutchan14-Sep-11 23:25 
QuestionRe: CRichCtrl Pin
David Crow15-Sep-11 2:42
David Crow15-Sep-11 2:42 
QuestionExecuting two project side by side Pin
Coder Block14-Sep-11 19:06
Coder Block14-Sep-11 19:06 
AnswerRe: Executing two project side by side Pin
Chandrasekharan P14-Sep-11 19:40
Chandrasekharan P14-Sep-11 19:40 
GeneralRe: Executing two project side by side Pin
Coder Block14-Sep-11 20:41
Coder Block14-Sep-11 20:41 
GeneralRe: Executing two project side by side Pin
Richard MacCutchan14-Sep-11 21:36
mveRichard MacCutchan14-Sep-11 21:36 
QuestionRe: Executing two project side by side Pin
David Crow15-Sep-11 2:44
David Crow15-Sep-11 2:44 
AnswerRe: Executing two project side by side Pin
Albert Holguin16-Sep-11 4:07
professionalAlbert Holguin16-Sep-11 4:07 
QuestionSimple C to C++ [modified] Pin
Software200714-Sep-11 8:20
Software200714-Sep-11 8:20 
Hi,
I would like to convert this function from C to C++.I attempted the conversion below, but not sure if I got it correctly.
- note: debugger would crash at msg[i] = nul in the c-like code.
-I also have the feeling this function can be written in 2 lines with strings!

Thanks


C++
#define NUL 0
char z_buf[4095]

void replace_html_delimiters(char *msg)
{
for(i=0; ; i++)
   {
	   if(msg[i]== NUL)
		   break;
	   if(msg[i]=='<')
	   {
		   msg[i] = NUL;
		   strcpy(z_buf,msg);
		   strcat(z_buf,"<");
		   strcat(z_buf,msg+i+1);//confusing me
		   strcpy(msg,z_buf);
	   }
   }
}


//C++
XML
<pre lang="c++">
#define NUL 0
char z_buf[4095]

void replace_html_delimiters(string msg)
{
for(i=0; ; i++)  //Why no upper limit here?
   {
       if(msg[i]== NUL)
           break;
       if(msg[i]=='<')
       {
           msg[i] = NUL;
           strcpy(z_buf,msg.c_str());
           z_buf += "<";
           strcat(z_buf,msg.rightOf[i]);
           strcpy(msg,z_buf);
       }
   }
}</pre>


modified on Wednesday, September 14, 2011 2:30 PM

AnswerRe: Simple C to C++ Pin
User 742933814-Sep-11 8:46
professionalUser 742933814-Sep-11 8:46 

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.