Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:07:11+00:00 2026-05-30T01:07:11+00:00

bada crashed on stringstream read. json::Object objDocument = d(); std::stringstream stream; json::Writer::Write(objDocument, stream); json::Object

  • 0

bada crashed on stringstream read.

json::Object objDocument = d();
std::stringstream stream;
json::Writer::Write(objDocument, stream);
json::Object objDocument2;
json::Reader::Read(objDocument2, stream); // <=== crash

or like this:

std::string *requestString = new std::string(data);
AppLog(requestString->c_str()); // <=== contains correct data
std::stringstream stream;
stream << *requestString;
const char *ddd = stream.str().c_str();
AppLog(ddd); // <==== contains random data

How can I solve it?
Who had ideas or same experience?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:07:12+00:00Added an answer on May 30, 2026 at 1:07 am

    The string stream.str() is a temporary which is destroyed right after you use it to get c_str() after which the pointer is no longer valid.

    If you save a reference in a temporary the string will stick around:

    std::string ddd_str = stream.str();
    const char *ddd = ddd_str.c_str();
    // ddd_str is still in scope and so ddd is still valid...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone know good tutorial for bada 2.0 JSON Parsing. Went through the JSON parsing
As I know Samsung Bada is not operating system but, just wonder if I
I am using bada and refer to the tutorial here , which begins: class
Recently Samsung presented Bada platform for mobile phone. http://developer.bada.com/apis/index.do I can find developer materials
I am an iOS developer migrating to BADA. In iOS we had a simple
I have a bada project setup for HVGA resolution. My sdk doesn't allow me
We have started working on samsung bada platform for our existing android apps and
Not that I'm doing something like that, but I am kind of interested how
I just start to try out my Hello World app development on Bada. I
How to share images in twitpic. Social API in bada is not supporting twitpic.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.