From: Zodiaq <zo...@as...> - 2003-08-07 01:09:17
|
Hello All MinGW users, there is some very strange for me going on about std::ostringstream... in my project I wanted to use it rathen than sticking with sprintf(stdio) or wsprintf(from windows.h or any included from it)... but when I want to use first sooner or later my program crashes... my program is composed of main window which using tab control shows three different dialogs... each of them may launch own thread to do some job for it... the problems starts when one of them receives some info which is visualised like this: #include <sstream> std::ostringstream some_text;//1: some_text.str( "" ); //2:to clear //and then for example: some_text << "Info: " << some_integer << std::ends; //to set text in some control (i.e. edittext control) is use: SendMessage( some_handle, WM_SETTEXT, 0, reinterpret_cast<LPARAM>( some_text.str( ).data( ))); after few such operation program crashes at some_text (1:)definition... I don't know where I made a mistake, I've forgot something as I have the same problems under VC++... I know that when I use sprintf programs works perfectly without any problems for as long as I want... does anyone know where I made mistake?? What am I missing? This is very annoying for me... btw by using sprintf I mean: #include <stdio.h> char some_text[ 50 ]; //size depends on where I want to use it sprintf( some_text, "blablabla %d", some_int ); SendMessage( some_handle, WM_SETTEXT, 0, reinterpret_cast<LPARAM>( some_text )); -- regards, Zodiaq |