|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bob10 (4) | ||||
|
Hi there, i'm trying to use a ostringstream to insert two integers in a string. This is my code at the moment:
The output of this function is:
Does anyone know why the first integer isn't appended to the ostringstream? My debugger says that "init " is followed by a \0. Why?! Kind regards, bob | ||||
|
Last edited on
|
||||
| jjlimax (2) | |
| This works for me. Try check your compiler settings. It is also possible that you have a strange sstream library. | |
|
|
|
| bob10 (4) | |||
|
I use gcc version 4.2.1 (Apple Inc. build 5646) on MacOS 10.6.1. In my desperation I wrote another test program:
and this works! ... confusing?! | |||
|
Last edited on
|
|||
| MaikCAE (56) | |||||
|
I had nearly such a problem sometimes but I can't really remember how I fixed it. Did you also try
or
| |||||
|
|
|||||
| Bazzy (6258) | |
| Try flushing the stringstream | |
|
|
|
| bob10 (4) | |
|
The problem is that I use Xcode as IDE. When compiling in bash with g++ the program works fine. Maybe some options in the Xcode build preferences are wrong. Anyway, thanks for your helpful suggestions! :-) | |
|
Last edited on
|
|
| bob10 (4) | |
|
The problem was that I compiled in Xcode for x64. Switching to i386 solves the problem. | |
|
|
|