Solved

A Easy Question From a Beginer

Posted on 1998-05-18
6
149 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
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…
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…

744 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

9 Experts available now in Live!

Get 1:1 Help Now