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
Solved

C++ CGI Help Needed

Posted on 1998-02-07
7
176 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
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
importing users to Security group 2 55
Powershell File Sort 8 41
Batch File search for Drive Letter 8 43
Renaming with batch file 4 39
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
This article will show, step by step, how to integrate R code into a R Sweave 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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

789 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