Questions tagged [sstream]
111 questions
0
votes
2 answers
Why is this returning an address in the console?
I'm trying to wrap my head around ostringstreams and istringstreams. So, as I always do, I made a log-in program out of it. but every time I try to cout the contents of the username and password variables, it returns the address!
Purpose for…
0
votes
1 answer
Error: cannot convert in simple std::string file slurper
I'm using some fairly simple C++ code to slurp the contents of a file into a std::string:
// Read contents of file given to a std::string.
std::string f = "main.js";
std::ifstream ifs(f.c_str());
std::stringstream sstr;
sstr <<…

beakr
- 5,709
- 11
- 42
- 66
0
votes
1 answer
about sstream, using a variable as array size and calculation overflow
It is required to read from a text file without knowing the size of array once and then calculate the mean and variance.
Now I cant create the specific arrays. As a result, I cant calculate the mean and variance.
I really hope that you guys can…

user2847449
- 21
- 7
0
votes
2 answers
c++: glibc invalid pointer error when src is 32bit compiled
I've written a program which compiles and runs well on my 64-bit machine (running linux SUSE). Now I need to call an external library but I only have access to the 32-bit binary. My source code compiles and links with no errors from ssh command line…
user2584416
0
votes
3 answers
(C++) std::istringstream reads up to 6 digits from string to double
folks! I've been struggling with this problem for some time and so far I haven't found any solution to it.
In the code below I initialize a string with a number. Then I use std::istringstream to load the test string content into a double. Then I…

Santus Westil
- 43
- 1
- 5
0
votes
4 answers
Parse c++ string using multiple threads
I have mmapped a huge file into char string and made a c++ string out of it. I need to parse this string based on a delimit character which is a space character and store the values in matrix. I could do it from one thread but I need to optimize it.…

Pthread
- 19
- 1
- 5
0
votes
5 answers
what does the left shift operator do in converting from integer to string in c++
Suppose you want to convert an integer into string this is the method in c++
int c1=999;
stringstream ss;
ss<

user2416871
- 543
- 1
- 4
- 13
0
votes
2 answers
Stringstream incompletely filled
Why does this code fragment:
if (iErr) {
std::stringstream ss;
string serror("error");
ss << "lua error code " << iErr << ": " << lua_tostring(lua, -1);
ss >> serror;
Log *log= StandardLog::getInstance();
log->logError("Lua…

Adder
- 5,708
- 1
- 28
- 56
0
votes
2 answers
using sstream in mingw 2.95 compiler
Is it possible to use sstream header in mingw 2.95 compiler?.If, it is, then how? I am using C-Free 4.0 and it comes with default mingw2.95 and cygwin compiler

N. F.
- 891
- 3
- 9
- 33
-1
votes
2 answers
OpenGL error(#97) No program main found even though the shader is correct and successfully read from a file
I was building my own shader based on the https://learnopengl.com/ tutorial.
The problem was that I have the following error when linking the shader program
VERTEX SHADER LOG
FRAGMENT SHADER LOG
WARNING: warning(#272) Implicit version number 110…

Mahmoud Kanbar
- 73
- 7
-1
votes
2 answers
string with embedded null characters
Is there any way that I can use istringstream to read strings with embedded null characters? For example, if I have a char array "125 320 512 750 333\0 xyz". Is there any way that I could get "xyz" after the null character?
#include…

Jim Yang
- 177
- 2
- 10
-1
votes
1 answer
how to make our own function like touch in c++
As soon as I add the below code this programs ends showing this error message:
Process returned -1073741819 (0xC0000005)
If I run those code separately then both of them work.
I used sstream and array too but combined they do not work…

Phantasm
- 17
- 7
-1
votes
1 answer
Can I ask and store input that can be both numbers or characters and use it in conditional expressions?
I am trying to use stroi in my "vending machine" code below. I had a working vending machine before I tried to add a feature that allows users to enter characters ("c" for checkout, "a" for add, and "r" for remove) as well. Since my user input can…

yeliah
- 41
- 6
-1
votes
1 answer
How can i open certain file's automatically in c++
I'm try to open certain file automatically in c++. File's title is same but only different file's number.
like this ' test_1.txt test_3.txt test_6.txt ... '
These numbers are not listed in regular sequence.
And here is my code
`
#include…

orde.r
- 521
- 2
- 5
- 13
-1
votes
2 answers
how to avoid buffer overflow with ostrstream
I have a code where i compile & load it in vxworks machine, i see the buffer overflow.
#include
#include
#include
using namespace std;
ostrstream *strm = 0;
int newcout()
{
if(strm == 0)
{
strm = new…

prashanth cm
- 49
- 1
- 1
- 4