endl is a so-called manipulator in C++. It outputs '\n'
and flushes the output buffer (using the flush method in the stream).
So, I would change the order:
cout << "Content-type: text/plain" << endl << endl << "Hello, World!" << endl;
Don't know if that solves it.
Regards
On Mon, Dec 13, 2010 at 10:18:58PM +0100, Jean-Francois wrote:
> Hello,
>
> Sorry for posting basic question here, would you please let me know why such
> script does'nt work (error with "Premature end of script headers") ?
>
>
> #include <iostream>
> using namespace std;
>
> int main()
> {
> cout << "Content-type: text/plain" << endl << endl << "Hello, World!";
> }
>
>
> It actually shows flush needed on google but I'm not able to do a hello world
> CGI in C++.
>
> Thjanks for your help,
>
> Reagrds