Solved

C++ CGI Help Needed

Posted on 1998-02-07
7
170 Views
Last Modified: 2013-12-25
I want to make a CGI Script that searches a file for keywords, and then returns an HTML page stating what it found...A search engine.  For example, if I wanted to search for "Luke Skywalker" (This is going to be a search engine of Star Wars characters and places), it would return an HTML page stating that is found something about Luke Skywalker, and then has a link to the page that tells about him.  

Now, Here are my questions:

1. What kind of file would I use as the database?  Can C++ read and write off of TXT or H files?  I mean, if put a class into an "H" file, (Like stdio.h, only it would be one of my own.) could it read it so that it would send a link to be put on the HTML page when it matched a certain string?

2. Do I need to compile the source code once I have written it?  Do I just compile it to an EXE file, and then change the extension to CGI?

3. What do I have to do to make sure that this code will run as a CGI script, and not as a normal C++ program?

5. Are there any special library files I need to use with a C++ CGI script?  Where would I get those?

4. Are there any free compilers that I can get that would run ok with Windows 95?  I am trying to understand DJGPP right now, but it isn't working because it is made for DOS.  I also have Turbo C++ LITE, but that won't compile into and EXE file that I can use outside of the IDE.

Thank you anyone for taking time to read this, and if you can answer any of these, I would greatly appreciate it.



0
Comment
Question by:Topace
  • 4
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
julio011597 earned 70 total points
Comment Utility
To answer your first question more details are needed:

what kind of archive are you going to search into?
BTW, yes, C++ can access text files, so can access header files as well, though a bit unusual.

About the other questions:

2. yes, compile your source as usual, then (most if not all web servers require you to) change the extension to ".cgi";

3. you just need to properly setup your web server, so that CGI scripts are enabled and there's a directory where they can be run from (the often heard "cgi-bin");

4. the only free compilers i know of come from the GNU foundation: gcc and its siblings.

To get more details, just add comments and i'll be glad to go deeper into the question.

Regards.
0
 
LVL 1

Author Comment

by:Topace
Comment Utility
How do I set up the server?  I mean, is there something special I need to do to get it to read CGI scripts?



Scott
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
This depends on what web server you are using.

Anyway, the web server configuration usually has stuff related to CGI, where basically you have to tell wether you want CGI enabled or not, and, if enabled, you should specify which particular directory should be allowed to hold CGI programs.

-julio
0
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!

 
LVL 1

Author Comment

by:Topace
Comment Utility
It really isn't my server.  How do I know if the server allows CGI scripts?  When I tried to use my CGI script, it started out right, with the HTML document (It placed the right title on the page, so I am sure it is reading it in HTML), but then it had all this other gibberish.  How do I get it to eliminate the gibberish?
0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
I cannot answer this, unless you show your code.

Anyway, keep in mind this: when you compile your source under, say, Win95, you have build a Win95 executable, so it won't work on your ISP server, unless its OS is Win32 as well.

If your ISP server is running a different OS than yours, you should upload your sources to it and compile with _its_ compiler.

The best way to solve your problems is contacting your ISP directly.

Good luck, julio
0
 
LVL 1

Author Comment

by:Topace
Comment Utility
It it very simple code.  If you give me your email address, I can send it to you.


0
 
LVL 5

Expert Comment

by:julio011597
Comment Utility
Ok, i won't give for sure that i'll make it work, but feel free to send it at: julio@webzone.it
0

Featured Post

IT, Stop Being Called Into Every Meeting

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

In this tutorial I will aim to show you how simple is making a small application in WhizBase, how to add, remove and update data in the DB. I will make a small address book application where you can add, browse, update and remove addresses. I wi…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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