本文介绍了用c ++编写的cgi可以直接输出到寡妇或控制台,是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立自己的第一个网站,并决定编写自己的cgi来处理表单和浏览器响应.我知道在Windows中,编程输出定向到窗口,而在控制台中,编程输出定向到控制台.编写cgi时,直接输出对浏览器意味着什么?

I am in the process of building my first website and have decided to write my own cgi for form handling and browser response. I know that in windows programming output is directed to a window and in console programming output is directed to the console. To what does one direct output meant for the browser when writing a cgi?

推荐答案


printf("Content-type: text/html\n");        // make receiving browser happy
if (total_printout != NULL)
{
    printf("Content-length: %d\n\n", strlen(total_printout)+total_newlines);
    printf("%s", total_printout);           // now send it
    free(total_printout);                   // return accumulated output
}
else
{
    printf("Content-length: 0\n\n");        // no output
}


这篇关于用c ++编写的cgi可以直接输出到寡妇或控制台,是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 07:20