|
hi,
i have to admit that i am quite new in c++. Nevertheless, the following confuses me really:
The function first() gets a lists of files from a directory returned from another function.
The function getText() should go through each file an extract a given part.
So far so good. But I just have to use an open statement in the function getText() and my list of files is cut to only 3 members instead of initialy 5.
Here the code for better understanding:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int first()
{
char **myFiles = listFiles();
for (int i=0; i < myClass::cnt; i++)
{
printf("FILE%i: -%s- \n", i, myFiles);
getText(myFiles);
}
return (1);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int getText(char *filename)
{
ifstream in;
in.open((string(DIRECTORY) + filename).c_str());
in.close();
return (0);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
output (without calling getText()):
FILE0: -file1-
FILE1: -file2-
FILE2: -file3-
FILE3: -file4-
FILE4: -file5-
output (calling getText() in function first)
FILE0: -file1-
FILE1: -file2-
FILE2: -file3-
FILE3: --
FILE4: --
There must be something very important I didn't get yet!!??
Can anybody help me?
thanx
jemy
|
|
|
|
|
|
|
|