[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

C++ CGI Help Needed

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
Topace
Asked:
Topace
  • 4
  • 3
1 Solution
 
julio011597Commented:
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
 
TopaceAuthor Commented:
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
 
julio011597Commented:
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
Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

 
TopaceAuthor Commented:
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
 
julio011597Commented:
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
 
TopaceAuthor Commented:
It it very simple code.  If you give me your email address, I can send it to you.


0
 
julio011597Commented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now