Solved

C++ CGI Help Needed

Posted on 1998-02-07
7
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
julio011597 earned 70 total points
ID: 1831965
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
ID: 1831966
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
ID: 1831967
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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
LVL 1

Author Comment

by:Topace
ID: 1831968
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
ID: 1831969
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
ID: 1831970
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
ID: 1831971
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

Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

Question has a verified solution.

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

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
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.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to dynamically set the form action using jQuery.

691 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