Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > is there memory...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 4268 of 4370
Post > Topic >>

is there memory corruption here?

by Bob Doe <DumpForJunk@[EMAIL PROTECTED] > Sep 10, 2008 at 05:35 PM

I've been told there is memory corruption for buf.str().c_str():

void myFunc()
{
  std::stringstream buf;
  buf << "some string";
  const char *data = buf.str().c_str();

  SomeFunc(data, strlen(data));
  //do something else
}


Can someone explain why?
 




 2 Posts in Topic:
is there memory corruption here?
Bob Doe <DumpForJunk@[  2008-09-10 17:35:23 
Re: is there memory corruption here?
Bart van Ingen Schenau &l  2008-09-11 11:02:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 10:13:59 CST 2008.