Solved

how to use C to write html

Posted on 1998-09-09
6
197 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now