Click here to Skip to main content
15,903,203 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: Simple C to C++ Pin
Software200714-Sep-11 9:02
Software200714-Sep-11 9:02 
GeneralRe: Simple C to C++ Pin
Chris Losinger14-Sep-11 9:06
professionalChris Losinger14-Sep-11 9:06 
GeneralRe: Simple C to C++ Pin
Software200714-Sep-11 9:16
Software200714-Sep-11 9:16 
GeneralRe: Simple C to C++ Pin
Chris Losinger14-Sep-11 9:21
professionalChris Losinger14-Sep-11 9:21 
GeneralRe: Simple C to C++ Pin
Software200714-Sep-11 9:28
Software200714-Sep-11 9:28 
GeneralRe: Simple C to C++ Pin
Chris Losinger14-Sep-11 9:36
professionalChris Losinger14-Sep-11 9:36 
GeneralRe: Simple C to C++ [modified] Pin
Software200714-Sep-11 9:49
Software200714-Sep-11 9:49 
GeneralRe: Simple C to C++ Pin
David Crow14-Sep-11 10:09
David Crow14-Sep-11 10:09 
GeneralRe: Simple C to C++ Pin
Software200714-Sep-11 10:13
Software200714-Sep-11 10:13 
GeneralRe: Simple C to C++ Pin
Chris Losinger14-Sep-11 10:16
professionalChris Losinger14-Sep-11 10:16 
GeneralRe: Simple C to C++ [modified] Pin
Software200714-Sep-11 10:21
Software200714-Sep-11 10:21 
GeneralRe: Simple C to C++ Pin
Chris Losinger14-Sep-11 10:38
professionalChris Losinger14-Sep-11 10:38 
GeneralRe: Simple C to C++ Pin
Chuck O'Toole14-Sep-11 14:54
Chuck O'Toole14-Sep-11 14:54 
GeneralRe: Simple C to C++ Pin
Chuck O'Toole14-Sep-11 14:13
Chuck O'Toole14-Sep-11 14:13 
AnswerRe: Simple C to C++ Pin
Chuck O'Toole14-Sep-11 14:08
Chuck O'Toole14-Sep-11 14:08 
AnswerRe: Simple C to C++ Pin
Chuck O'Toole14-Sep-11 14:32
Chuck O'Toole14-Sep-11 14:32 

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.