I don't know. I tried it before, but I did something wrong. Works now.
I don't know. I tried it before, but I did something wrong. Works now.
"The Internet treats censorship as damage and routes around it." - John Gilmore
Why dont you just receive data with char recevied[1024] (for instance) and then just (in a loop):
std::string recv_buff;
recv_buff += received;
l2u, I like strings even less than vectors (don't ask why).
Anyway, I have this vector:
It's basically like a vector of char arrays (actually char vectors).Code:std::vector<std::vector<char> > datar;
Now this should work (it should add a to the first subvector of datar):
But windows throws an error "blabla has encountered an error and needs to close"...Code:datar[0].push_back('a');
Everything I do with those subvectors gets me a that error...
Actually I know a possible solution, but I don't understand why this doesn't work.
I could make a temporary vector and when I'm finished with one of those I just insert it to the end of the main vector.
Last edited by maxorator; 01-05-2007 at 11:46 AM.
"The Internet treats censorship as damage and routes around it." - John Gilmore
Does datar[0] even exist? Consider:
Code:std::vector<std::vector<char> > datar(1); // create datar[0] datar[0].push_back('a');
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I am sooo stupid. I think i was somehow expecting it to allocate memory automatically for that too. Thanks.
Last edited by maxorator; 01-05-2007 at 12:11 PM.
"The Internet treats censorship as damage and routes around it." - John Gilmore
Why would using vector be better in this case?Originally Posted by maxorator
Would it be faster?