I am doing a multipart POST to a form. The data contains a ZIP file so I need to include a "boundary". The problem I am having is that I cannot add the boundaries in between the data. Whenever I add them, it never shows uip in the header. How can I add the proper headers to my POST...
I need to contain the entire file stream in the buffer, therefore the buffer should be the same size as the file. I am running the code below, but it seems to hang. However if I output to a file ofstream out ("test.txt",ofstream::binary) it does not hang...
{
char *buff...
I am now trying this code block:
#include <string>
std::ifstream in(fileName);
std::ostringstream tmp;
tmp << in.rdbuf();
std::string str = tmp.str();
And I get these of compilation errors:
D:\DOCs\inetConsole\inetConsole.cpp(307) : error C2079: 'in' uses undefined...
Why are the buffers only a sizeof 4 after the code is excuted? I need to fill the buffer completely.
long lSize;
char * buffer;
lSize = 10504120
ifstream in;
in.open (fileName);
filebuf *pbuf;
pbuf=in.rdbuf();
pbuf->sgetn (buffer,lSize);
cout <<...
Here was some code submitted by Dietmar Kuehl...
Just read the file when constructing the string:
int main() {
std::ifstream in(filename);
std::istreambuf_iterator<char> beg(in), end;
std::string str(beg, end);
}
I have been looking into the fastest way to read a file into a char*. I have seen some code implementing istreambuf_iterator. Any one else have any experiences with this?
- julian
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.