Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI problem

Status
Not open for further replies.
Mar 13, 2000
20
CA
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(&quot;CONTENT_LENGTH&quot;);<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 &gt;&gt; buffer;<br>
DoSomethingWithIt (buffer);<br>
delete [] buffer;<br>
<br>
The problem was at the line cin &gt;&gt; buffer. Somehow the buffer couldn't be filled (i.e. the browser kept waiting). I removed this line (cin &gt;&gt; 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>

 
There is a site containing all the necessary libraries and source code also for CGI programming with C++ . I have made CGI programs using C on Linux . So I can help you to get the source code only. <A HREF=" TARGET="_new"><br>
Probably this would help you.<br>
siddhartha singh<br>
<A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top