Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Assertion in stringstream?

This topic is 6305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve started getting debug assertions on my fps display code which uses a stringstream to combine my text and numbers. I poked around and found that the assertion seems to appear on this line : std::stringstream temp; Not much to go wrong is there... I''m not out of memory... Can anyone think of why this would occur, about every 30 seconds that the application runs(this part of the code runs only once per second). Oh, I''m using VC7(.net). Is there a better way of putting my int in a string? Many thanks

Share this post

Link to post
Share on other sites
I know of a simple way to put an int into a string but I don't know what's causing you that error. Here goes

char string[80];
int number=4;

sprintf(string,"I've put the number %d, into my string",number);

this show make the string: string read as:

I've put the number 4, into my string

this function sprintf is part of the C library and the header file for this u should include is


I hope I helped

Dark Star

Edited by - Dark Star on September 5, 2001 11:27:57 AM

Share this post

Link to post
Share on other sites
Sometimes (at least with MSVC 6.0), the assertion is actually on the line before where the green arrow appears in the debugger.

Does this function only crash after a certain time? It sounds from your post like this line is being run successfully a number of times, and then crashes later. If that''s the case, you may have a wild pointer or something. I''d set a breakpoint and step through--you should be able to see exactly what the assertion is since STL source is available.

I haven''t seen that kind of behavior from stringstream before.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!