Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to use C to write html

Posted on 1998-09-09
6
203 Views
Last Modified: 2012-05-04
Not long ago, I saw a web page to teach how to use C to write HTML and JavaScript. He called this topic is
HTML-based interfaces with c.

I will give 35 points to who can show me the step by step
to use C and ADA  to create html and javascript.
The expert who give a little bit wrong answer will receive
    f or rejected. Aslo If the expert who can give me the perfect answer will recieve another extra points.
    Thank you !
0
Comment
Question by:tanc02
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:slinky
ID: 1837513
You don't want much for your 35 points!
Anyway, you want to search for CGI and C
There are lots of places on the net with example code but before you start make sure you can put CGI programs on your Web server and that the compiler you have produces executables that can run on the machine on which your server resides.
0
 

Expert Comment

by:MicroSeyed
ID: 1837514
If You Give me 300 Points I will Tell You ... !!!!! May Only I Knew what you want !!
0
 
LVL 1

Expert Comment

by:slinky
ID: 1837517
Go to http://www.infoseek.com
In the search box type +CGI +C
you will get a list of hundreds of places that have the information you require
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Accepted Solution

by:
DavidME earned 40 total points
ID: 1837518
Yes, what you are looking for is to code a CGI (Common Gateway Interface) program in C.

Basically, the program runs on the web server. You need that the owner of the web server let you to put your executable to run, usually in a /cgi-bin directory or with a .cgi extension.

You have to ask permission because most ISPs won't allow you to run anything on their servers. An alternative is to get your own webserver, you'll need one at least for the testing.

You can call the program form the url: <A HREF="server.com/cgi-bin/program.exe">, or from a form <FORM NAME="fFormName" ACTION="server.com/cgi-bin/program.exe" METHOD="GET">.

Then the program is run. It can receive the parameters from the command line (method='GET') or reading from stdin (method='POST').

Some important information such as where the clients are and where they came from is stored in environment variables.

The programming goes like this:
Having received your parameters and variables, you process them, you acces your data and read the files, databases or sensors or whatever you need and then you write to stdout the page that the client will recieve.
First you write the headers for the HTTP protocol, like this,
 printf( "Content-type: text/html\n");
then a blank line:
 printf( "\n");
the rest of the page:
 printf( "<HTML>\n\
<HEAD><TITLE>%s</TITLE></HEAD>\n\
<BODY>\n\
<P>%s</P>\n\
<P>%s</P>\n\
</BODY>\n\
</HTML>\n",
"Page title", szParagraph1, szParagraph2
);

 You could do it in any language that can read and write from standard input, Perl, shell script, .BAT files, C, C++, Pascal,...

 You get the idea, don't you?

Get an interesting C library to handle the usual chores from http://www.boutell.com/cgic/

http://echo.znet.de:8888/ shows the headers you are sending to the server.

For more information, search for "CGI" and "C" or get a book on "CGI programming in C".
0
 

Expert Comment

by:DavidME
ID: 1837519
I forgot to tell:

If you want to include Javascript in the result page, It's like writing any other code.

printf( "<SCRIPT>\n\
function fFunction( )\n\
{if( '%s'== vVariable)

}
0
 

Expert Comment

by:DavidME
ID: 1837520
I submitted too fast :)

If you want to include Javascript in the result page, it's like writing any other HTML code.

printf( "<SCRIPT>\n\
function fFunction( )\n\
{if( '%s'== vVariable)\n\
{alert( 'This is an alert');\n\
}\n\
}\n\
</SCRIPT>\n", szTheTextYouWantToCompareWith);

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question