Infame 0 Newbie Poster

Hi! I made a little snippet to play around with...

int readThis::compareData(readThis &Source) {
    string sBuff, sBuffcpy;
    this->cFile.open(zsFile), (&Source)->cFile.open((&Source)->zsFile);
    if (this->cFile.is_open() && (&Source)->cFile.is_open()) {
        while(!this->cFile.eof(), !(&Source)->cFile.eof()) {
            getline(this->cFile, sBuff), getline((&Source)->cFile, sBuffcpy);
            if (sBuff == sBuffcpy) {
                if (this->cFile.eof() && (&Source)->cFile.eof()) {
                    return FILE_SUCCESS;
                    exit(1);
                }
            }
            else {
                return FILE_NOT_SUCCESSFUL;
                exit(1);
            }
        }
    }
    else {
        return FILE_UNABLE_OPEN;
        exit(1);
    }
    this->cFile.close(), (&Source)->cFile.close();
}

I had to change it each time due to the fact that it returned different on each return...

eg:

RETURN: 6 (Correct)
RETURN: 7 (Not)
RETURN: 6 (Correct)
...
...

in main:

readThis Obj1("C:\\Users\\ZG\\Documents\\cppbot.cpp");
    readThis Obj2("C:\\Users\\ZG\\Documents\\cppbot.cpp");
    cout << "Comparison2: " << Obj1.compareData(Obj2) << endl;
    cout << "Comparison3: " << Obj2.compareData(Obj1) << endl;
    cout << "Comparison4: " << Obj1.compareData(Obj2) << endl;

zsFile is of type char* and cFile is, ifstream cFile; BOth declared in defult private.

I tried changing the code over and over again, but no luck. Could anyone explain?

Thanks.