Solved

A Easy Question From a Beginer

Posted on 1998-05-18
6
163 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

821 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