Solved

how to use C to write html

Posted on 1998-09-09
6
205 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
[X]
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
  • 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

717 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