Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

A Easy Question From a Beginer

Posted on 1998-05-18
6
Medium Priority
?
182 Views
Last Modified: 2013-12-25
This is my first time in CGI, i need to develop a app that stores the fields of a form in a file in the server

I'm thinking in using C/C++, i've been told that CGI is about parsing the parameter passed to the application!

If this is true, i can build a dos based C/C++ app that will parse the argv parameter and write the values to a file, is that rith??

If that's ok, i need to know how are the values of the form fields passed to the app, and how can i give the user a response??

please if you can do provied me with c/c++ examples!
0
Comment
Question by:PedroMVGomes
  • 3
  • 3
6 Comments
 

Accepted Solution

by:
ShadowSpawn earned 140 total points
ID: 1828835
First Question is what kind of server you're running on.  But, regardless of that you can find a good generic C library for handling all the parsing / decoding at http://www.boutell.com/cgic/ .  After you've read the form input, saved  it or whatever you simply return a stock webpage to the user by using the Location HTTP header or using a
printf("Content-type:text/html\n\n";
printf("Whatever<br>\n");


Enjoy

0
 
LVL 2

Expert Comment

by:tpryor
ID: 1828836
perl is so easy for parsing text. I'd say it is the only way to go.
or you can use perl in your c code.
check out www.cpan.com

t
0
 

Expert Comment

by:ShadowSpawn
ID: 1828837
PERL is nice, but a compiled C script is at least twice as fast and your source code is protected.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:tpryor
ID: 1828838
as far as speed goes, you only get the hit for compilation after that it is on par with c, and with isapi and such your perl code only compiles once then runs in memory on any other calls to your code, your perl code is also protected, remember it gets executed not sent to the browser.

typicaly the form info is so small it is like using a hammer to kill a fly if you write such a think in c, anyway c is way too clumsy when it comes to text.

IMHO
t

0
 

Expert Comment

by:ShadowSpawn
ID: 1828839
Average Run Time for a comparable compiled CGI will always we faster than an interpreted script. No arguements allowed.  As far as protection goes, I'm refering to protecting your code from theft / alteration by others --- either client , host or what have you.  But Yes --- if all you need is a basic form response then perl is much easier.  But if you are even a descent C programmer, you can do just about anything you want with CGI's in C/C++.
0
 
LVL 2

Expert Comment

by:tpryor
ID: 1828840
not saying you couldnt, just that...

1) easier (typically one paragraph, c 3pg)
2) compiled (speed)
3) not clumsy (text)

nothing is 100% safe from theft on computers. and have you heard of decompilers.

You know c is great for large scale apps but ypically when working with forms or internet apps it is really over kill.  We arent building some realtime 3d graphics engine, thats when c shines.  However you could allways beat it with assembly. <gr>

BTW. you can embed perl in c.
best of both worlds.

IMHO
t
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

916 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