I'm learning c++, please be gentle. Am struggling to find my feet after too long with Ruby.
Basically, I'm trying to get a http response, split it up and then save various parts as variables.
I'm using happyhttp instead of curl because it's smaller and we can't use boost as recommended in other SO posts.
The response we get looks like this:
Nzov1td_xs4MNlnTd5sU:60:60:websocket,htmlfile,xhr-polling,jsonp-polling
I've tried putting in in stringstream and then using getline but that obviously just outputs the lines:
stringstream os;
os << data;
string s = os.str();
std::string segment;
while(getline(os, segment, ':'))
{
cout << segment;
}
I need something like this (I know the syntax is wrong):
socketID = segment[0]
timeout = segment[1]
heartbeat = segment[3]
Genuinely don't know what I should be looking for to get this working?