Solved

A Easy Question From a Beginer

Posted on 1998-05-18
6
153 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 70 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

19 Experts available now in Live!

Get 1:1 Help Now