Re: CGI C and HTML

From: Sean Kenwrick (skenwrick_at_hotmail.com)
Date: 12/27/03


Date: Sat, 27 Dec 2003 10:12:23 +0000 (UTC)


"Sergio" <emsrome@libero.it> wrote in message
news:6daea39c.0312270059.526c7f16@posting.google.com...
> Merry Christmas to You all.
> My system: WIN XP, DEV CPP 4.x(C compiler).
>
> Consider this HTML code.
>
> <HTML>
> <BODY>
>
> <FORM NAME="MyForm" ACTION="c:\PATH\MyProgram.exe" METHOD="GET"
> ENCTYPE="application/x-www-form-urlencoded">
>
> <INPUT TYPE="TEXT" NAME="MyString">
> <INPUT TYPE="SUBMIT" NAME="Iaccept" VALUE="OK">
> </FORM>
> </BODY>
> </HTML>
> This code should have to produce a string("MyForm") and on SUBMIT,
> this should be sent to MyProgram.exe to be processed.
>
> Consider this C code.
>
> #include <stdio.h>
>
> void main(int argc, char *argv[]){
>
> /* Your code */
> char *MyForm;
> FILE *filePtr;
> filePtr=fopen("c:\\PATH\\MyText.txt","w");
> fprintf(filePtr,"%s",MyForm);
> return NULL;
>
> }
>
> The above C code should have to capture the HTML contents and to put
> it into MyText.txt.
> Does't interest to tokenize and to unescape the string.
> I need to understand the mechanism of CGI C(pure ANSI C, better
> unstructured).
> Particularly, how could I capture by a C program a string comes from
> another program.
> For example, on command line by argv[], I can pass a string to the
> program; unfortunately this procedure doesn't run between two
> programs. Better I'm not able to exchange a string between programs,
> without using any disk, only from RAM.
>
> Greetings from Italy
>
> Sergio

To pass data between two programs you can read and write to stdin and
stdout. So if you have
prog1, prog2 and prog3 that all read from stdin and write to stdout then on
the command line you can
do something like:

prog1 | prog2 | prog3

Sean



Relevant Pages

  • Re: CGI written in C
    ... Because CGI are connected to the HTTP server thru stdin and stdout. ... Where did you want to send "some string" to? ...
    (comp.unix.programmer)
  • Re: proc_open problem: translates to Windows-style line return
    ... to allow PHP to communicate with a proprietary database. ... the appropriate response (via its stdout). ... fwriteto send to the component's stdin and freadto read from the ... So the problem is that if I send a n byte string ...
    (comp.lang.php)
  • proc_open problem: translates to Windows-style line return
    ... to allow PHP to communicate with a proprietary database. ... the appropriate response (via its stdout). ... fwriteto send to the component's stdin and freadto read from the ... So the problem is that if I send a n byte string ...
    (comp.lang.php)
  • Re: Static HTML using PHP
    ... you can do this by, instead of outputting your HTML code, catching it ... into a string, and when done parsing spit the HTML code into a file ... (I think more people should embrase caching). ... Matt Smyth wrote: ...
    (alt.php)
  • Re: Web Form acts differently when using C# than VB
    ... The value of "SomeKey" is not a string. ... > I have a sample web form in C# that works correctly. ... > Part of the VB HTML code looks like this: ...
    (microsoft.public.dotnet.framework.aspnet)