Listing 1: Loading and saving a password file

void 
PasswordFile::writeDataFile (void)
{
  __dataFile.open(__dataFileName, 
                  ios::out);
  if ( __dataFile.good() )
  {
    Collection::Cursor 
    cursor(UserCollection);
    forCursor(cursor)
    {
      __dataFile    
      <<
      UserCollection\
      .elementAt(cursor)\
      .name.asString()
      << endl
      << 
      UserCollection\
      .elementAt(cursor)\
      .level.asString()
      << endl
      << 
      UserCollection\
      .elementAt(cursor)\
      .password.asString()
      << endl;
    }
  }
  __dataFile.close();
}
void 
PasswordFile::readDataFile (void)
{
  __dataFile.open(__dataFileName, 
                  ios::in);
  while (true == __dataFile.good())
  {
    IString name, level, 
            ilevel, password;
    __dataFile >> 
          name >> 
         level >> password;
      // *** This doesn't work! ***
    if ( true == __dataFile.good() )
    {
      UserObject 
      userObject(name,
                 level,
                 password);
      UserCollection\
     .addOrReplaceElementWithKey(
         userObject);
    }
  }
  __dataFile.close();
}