nikita,

As others have pointed out, it's trivial for a cgi (in whatever language) program to interact with another program. Happens all the time in perl where the script either fork/execs, systems, or backticks a program.

That being said there's one part of your question that puzzles me - the user can contitue interacting with the program via the html page ... c++ does not finish after the first output. This is going to be quite difficult due to several reasons:

Even if you get around those limitations with state tricks and apache embedding (mod_perl), web servers tend to be farms so you may have to coordinate across web serves too (or at least ensure the request always goes to only one machine in the farm - hooray for mod_rewrite/mod_proxy).

That being said, I think what you want can be done but it's going to take a lot of planning and a lot of design.

-derby

update: Now that I think of it, this would be kinda neat to set up as a SOAP server. You would wrap the c++ in a SOAP server and then the cgi-script would just be a SOAP client. You may still need to keep state with your cgi-script but you wouldn't need to worry about the lifetime of the c++ program (at least not in your web server/cgi world).


In reply to Re: Can this be done? by derby
in thread Can this be done? by nikita

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.