• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net

Anyway to do this on websites?

JinYong

New Member
Hi, I am wondering if it was possible for me to call a function within a program written in C that is running continuously through a webform of some sort? Is it possible through CGI?
 
I haven't used CGI myself, but seeing as CGI is a server side scripting language, and not created for these tasks, I'd doubt it's possible. What you can do however, is to use .NET and C# for this, but I have no experience with this at all.

If I were you, and really needed to use C to accomplish something in a browser based environment, I'd use Java. Java is much better suited for this, but you may consider the consquences of the loss of cross platform compatibility when you use platform specific C code.
 
I don't think using Java is an option....The program that I made is too big to start over and remake with Java.

Basically what I'm trying to do is:

Have a website: say form.htm
Then in it have a field where u can type in an option on the
form.htm. So in my case type 1 to run f1(), type 2 to run f2().

Not really sure how you can interact with functions within a C program
via website.
 
I gather what you're trying to do is generate the page first, then call your C code after the user does something without having to submit a form to reload the page. Normally in order to run server-side code you'd have to direct the visitor to a new page. You can get around this however with some javascript using XMLHTTPRequest (google it for some details). Of course it still calls urls rather than the functions directly, so you'll need to have it pass parameters that trigger the appropriate function. Also, note that using XMLHTTPRequest can lead to your page not functioning in older web browsers.
 
Last edited:
Back
Top