Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C++ on the web?

disco_studisco_stu Member Posts: 44
How do I implement c++ programming on web pages, so that I can run c++ code in the background when someone goes to a web page? If I wanted to create a random number whenever someone clicked my RANDOM button, for instance, and I wanted to do it in c++, not Java. Could anyone please tell me how to do this, or point me to references that can tell me? Thanks in advance for any help.

Comments

  • DariusDarius Member Posts: 1,666
    : How do I implement c++ programming on web pages, so that I can run c++ code in the background when someone goes to a web page? If I wanted to create a random number whenever someone clicked my RANDOM button, for instance, and I wanted to do it in c++, not Java. Could anyone please tell me how to do this, or point me to references that can tell me? Thanks in advance for any help.
    :

    Umm... if you want something like an applet, then you'll need to find a C++ to Java Byte Code compiler. (There ARE backends to GCC that do this, though to varying degrees of compatibility and completeness. One of those projects may have made a generally usable solution.) There is also some virtual machine specification for C/C++, but I doubt most people have that virtual machine. The only other solution on the client side would be to distribute your program which would require the user downloading your program and executing it (which is exactly what they'd do with Java...). However, for a variety of reasons that isn't a good solution for just dynamic pages.

    However, if you mean server-side things (i.e. CGI, e.g. JSP, ASP, Servlets, etc.) Then that can definitely be done with C++. The CGI specification is quite language independent. It just specifies that certain environment variables will be setup with certain values and that the stdin will be connected to a stream of data from the client (if the POST method is used) and output should be sent to the stdout. As every language that has IO is can read from the stdin and write to stdout that means every language can be used as a CGI. Shell scripts can be used as CGI's. For information on how to do that checkout www.cgi101.com. The implementation of the CGIs is in PERL, but that shouldn't keep you from getting the idea of how to get and send data.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion

  • pingpongpingpong Member Posts: 937
    What Darius said.

    2 other options if you dont mind using ASP.NET.

    1. Use C# (or VB.NET) as your source server-side language. C# especially is very close to C++.

    2. Write all the stuff you want in C++ and put them in a DLL on the server, then use ASP.NET again with either C# or VB.NET to call methods from your DLL.

    Whichever you chose, this is ASP, you are going to need a Windows server with IIS. But anybody with any browser or OS can access and use your pages.

    : How do I implement c++ programming on web pages, so that I can run c++ code in the background when someone goes to a web page? If I wanted to create a random number whenever someone clicked my RANDOM button, for instance, and I wanted to do it in c++, not Java. Could anyone please tell me how to do this, or point me to references that can tell me? Thanks in advance for any help.
    :

  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _______ \ http://forcoder.org \ free ebooks and video tutorials about [ Delphi, Objective-C, Python, C, JavaScript, C#, Scratch, PL/SQL, Ruby, MATLAB, PHP, Assembly, Swift, Visual Basic .NET, Perl, Visual Basic, Go, R, Java, C++ Bash, Scala, ABAP, Lisp, Rust, Alice, Scheme, Crystal, D, VBScript, LabVIEW, Transact-SQL, SAS, Apex, Fortran, Logo, Awk, Julia, Hack, Ada, ML, Clojure, F#, FoxPro, Dart, Kotlin, Erlang, Prolog, COBOL, Lua ] ___________

Sign In or Register to comment.