c++ - Serialize PNG and Send to Rest Client -
iam sending images in png format rest clients. when download file on client side , try open it, errors. believe headers of file missing, how can add them serverresponse?
on details of picture can see, size , on missing.
ifstream stream; stream.open(fullfilename,std::ios::binary); string content, line; if (stream) { while (getline(stream,line)){ content += line; } } stream.close(); request::request->set_body(content);
after searching around found post post on side.
and sequenze create that.
ifstream *stream = new ifstream(fullfilename, std::ios::in | std::ios::binary); std::ostringstream *oss = new ostringstream(); *oss << stream->rdbuf(); string *content = new string(oss->str()); stream->close(); request::request->set_body(*content);
Comments
Post a Comment