Questions tagged [strstream]
13 questions
83
votes
4 answers
Why was std::strstream deprecated?
I recently discovered that std::strstream has been deprecated in favor of std::stringstream. It's been a while since I've used it, but it did what I needed to do at the time, so was surprised to hear of its deprecation.
My question is why was this…

andand
- 17,134
- 11
- 53
- 79
7
votes
1 answer
How will std::spanstream usually be used in C++?

Desmond Gold
- 1,517
- 1
- 7
- 19
4
votes
2 answers
Applying strstr() multiple times on same string in C
I'm trying to write a code that extracts all words/strings between the and tags using strstr. But it seems that it just gets stuck to the first string extracted, which is "quick". How can I get the code to keep going after extracting the first…

Syvil San Pablo
- 43
- 1
- 5
3
votes
1 answer
How to initialise std::istringstream from const unsigned char* without cast or copy?
I have binary data in a byte sequence described by const unsigned char *p and size_t len. I want to be able to pass this data to a function that expects a std::istream *.
I think I should be able to do this without copying the data, unsafe casts or…

paperjam
- 8,321
- 12
- 53
- 79
3
votes
2 answers
ostrstream interprets constant string as pointer
I ran across this problem while cleaning up the debug macros of an old C/C++ application: We have a Tracer class inheriting from ostrstream (I know it's been deprecated since C++98, but this application was written in 1998!) which we use like…

l4mpi
- 5,103
- 3
- 34
- 54
2
votes
2 answers
String stream related problems
I am trying to do the following
std::stringstream str;
string string1, string2;
long a = 23343;
long b = 323234;
str << std::hex << a;
str >> string1; //line no. 6
str << std::hex << b;
str >> string2; //line no.8
a & b are values…

gst
- 1,251
- 1
- 14
- 32
1
vote
2 answers
basic_stringbuf has no member named 'freeze'
The following code fails to compile:
#include
#include
int main()
{
std::ostrstream strm;
strm.rdbuf()->freeze(0);
}
I get the following errors on compilation:
g++…

pankaj kushwaha
- 369
- 5
- 20
1
vote
0 answers
std::strstream not implementing eof and peek properly?
I have a byte data source defined like this:
char * data;
unsigned int dataSize;
dataSize is non zero and often quite large (megabytes)
The following code works:
std::string str(data, dataSize);
std::istringstream stream(str);
char firstByte =…

galinette
- 8,896
- 2
- 36
- 87
1
vote
1 answer
What is substitute for strstream's pcount and freeze in stringstream?
I have old c++ code using strstream and using pcount and freeze methods of the same.
I want to use stringstream class instead. What are the substitute for pcount and freeze methods of strstream? The code is something like this:
strstream log; //…

Sam
- 243
- 1
- 9
- 22
0
votes
2 answers
Converting strstream to sstream conflict about c_str()
I have this code block as written with strstream. And I converted it to sstream as below. I'm not sure, but I think printStream->str() is returning a string object with a copy (temporary) of the contents in the stream buffer pointed by printStream,…

şentürk şimşek
- 11
- 4
0
votes
3 answers
strstream in c++
I am writing the code
#include
#include
using namespace std;
int main(){
strstream temp;
int t =10;
temp>>10;
string tt ="testing"+temp.str();
Have a problem, it does not work at all for the temp variable, just get in result…

Ptichka
- 285
- 3
- 4
- 8
0
votes
1 answer
Trying to read the contents from strstream causes access violation
I am trying to read the contents of an ostrstream using the str (). While trying to do so, i always come across access violations and my application crashes. Is there a way to read from strstream without causing stream errors?
I am working on a…

rioCoder
- 11
- 1
- 5
-3
votes
1 answer
query regarding ostrstream
Firt of all i would like to let all know that ostrstream is deprecated and it should not be used in future.
but my doubt is something else.
the source code of my application has code like below.
ostrstream o;
o << cell.value(CI) << "-" <<…

Vijay
- 65,327
- 90
- 227
- 319