my final assignment is about making a program like a TinyGoogle.. But actually, i'm just a Freshman and it's kinda hard to have all the knowledge to make these all through.. Hope u guys can help, thanks a lot

http://kalodakilla.googlepages.com/CS162-Final-Project-TinyGoogle.pdf

The first problem is that i dont understand what does the command line in the requirement means, i tried to type the command line like that, but it always returns "Wrong Path".. Does anybody know?

Recommended Answers

All 10 Replies

Take the FileList as the only command line parameter. For example,
C:\>TinyGoogle.exe myfilelist.txt

You need to create a file that contains the names of all the other files that your program is to index. So you have to create myfilelist.txt before you can do anything.

>>what does the command line in the requirement means
I assume you are using MS-Windows ??? Then it means to click the Command Prompt icon on your desktop if you have one, or Start --> Assoirceries --> Command Prompt. Then type that in the command prompt window. Of course you will have had to have written and compiled your program before it will work.

ic, thanks a lot AD, but i don't know how it may work :-? does it mean when i type in that command line, i will get to the text file or get to the exe file ?

both -- first the exe file is run then your program should use the file name that you typed. The file name will be in the argv parameter to main

int main(int argc, char* argv[])
{

}

In the above argc is the number of command-line arguments you typed plus 1. So in your example the value of argc will be 2. If it isn't 2 then you did something wrong on the command line.

argv[] is an array of the argument strings. argv[0] is always the name of the exe program, and argv[1] will be the name of the textfile you typed on the command line.

So to open that text file for reading you do something like this:

#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
    ifstream in(argv[1]); // <<<< opens the file for reading
}

oh, i understood now, thanks a lot, this is helping much :)

You might find STL maps useful for your "inverted structure". They're associative arrays, which makes searching for a particular element (e.g. the list of documents containing "bush") really quick and easy. They allow you to use e.g. a string ("bush", or "iraq") as the index... The element could also be something like a list of, say, document numbers...

can u tell me more details boyt STL maps? what does it stand for?

Oh, this is new to me, reading to understand further :-?. Anyway, thanks a lot :)

However, i just did some coding and get to the Retrieval part, i'm kinda meeting some problems, err, don't know how to say...

Assume that we have a path of a txt file, then how can we print out the whole documents in that txt file :-/ i tried to print out each element of the text file, but failed, does anybody know how to do it better :-/

oh can anybody help please :((

Assume that we have a path of a txt file, then how can we print out the whole documents in that txt file :-/ i tried to print out each element of the text file, but failed, does anybody know how to do it better :-/

What did you try, and what is the immediate aim? Can you actually read the file? what/how failed?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.