Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to write an HTML form in C or C++ [closed]

I use PHP and I know that PHP is written in C or uses C somehow. I'm trying to understand lower level languages. So can someone explain to me how the HTML that PHP generates (let's say the markup for a form) is built with C. Can I build a web form in C or C++ and how?

like image 857
sameold Avatar asked Dec 03 '22 00:12

sameold


1 Answers

It's possible to write a Common Gateway Interface (aka "CGI") program in any computer language which can send text to the standard output channel (i.e. pretty much every one):

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Content-type: text/html\n\n");
    printf("<pre>Hello, World!</pre>\n");
    return EXIT_SUCCESS;
}

[html, body, etc tags omitted for brevity].

like image 154
Alnitak Avatar answered Dec 04 '22 13:12

Alnitak