bluejacket
ISP
I had a problem of building CGI using Visual C++. The book said that in order to get the input stream from the browser the following code can be used: (METHOD = POST):<br>
<br>
// Get the size of the input stream<br>
char* contentSize = getenv("CONTENT_LENGTH"<br>
if (!contentSize)<br>
return;<br>
long dataSize = atol(contentSize);<br>
if (!dataSize);<br>
return;<br>
<br>
// Read the input stream<br>
char* buffer = new char[dataSize];<br>
cin >> buffer;<br>
DoSomethingWithIt (buffer);<br>
delete [] buffer;<br>
<br>
The problem was at the line cin >> buffer. Somehow the buffer couldn't be filled (i.e. the browser kept waiting). I removed this line (cin >> buffer) and checked the dataSize .. it appeared correct (i.e. not equal to zero).<br>
Please advice if you know the problem here. BTW, I am using Visual C++ version (6.0). Thank you.<br>
<br>
// Get the size of the input stream<br>
char* contentSize = getenv("CONTENT_LENGTH"<br>
if (!contentSize)<br>
return;<br>
long dataSize = atol(contentSize);<br>
if (!dataSize);<br>
return;<br>
<br>
// Read the input stream<br>
char* buffer = new char[dataSize];<br>
cin >> buffer;<br>
DoSomethingWithIt (buffer);<br>
delete [] buffer;<br>
<br>
The problem was at the line cin >> buffer. Somehow the buffer couldn't be filled (i.e. the browser kept waiting). I removed this line (cin >> buffer) and checked the dataSize .. it appeared correct (i.e. not equal to zero).<br>
Please advice if you know the problem here. BTW, I am using Visual C++ version (6.0). Thank you.<br>