Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 14th, 2010  |  syntax: C++  |  size: 0.90 KB  |  views: 246  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Check for user name, this all executes perfectly fine.
  2.         ofstream oFile;
  3.         ifstream iFile;
  4.        
  5.        
  6.         iFile.open("/APPData.dat");
  7.          if (iFile.is_open())
  8.          {
  9.            while (!iFile.eof())
  10.            {
  11.                  getline(iFile,holdUsername);  
  12.            } //When the WHILE ENDS it jumps straight to "enter selection" down there.
  13.          }else{                  
  14.                  oFile.open("/APPData.dat");
  15.                  oFile.close();
  16.                  
  17.                  iFile.open("/APPData.dat");
  18.                      if (iFile.is_open())
  19.                {
  20.                              while (!iFile.eof())
  21.                    {
  22.                                      getline(iFile,holdUsername);  
  23.                                }
  24.                          
  25.                    }
  26.                }
  27.        
  28.         //This wont execute!, It skips to "enter selection"
  29.         if (sizeof(holdUsername) < 2)
  30.         {
  31.                 cout << holdUsername;
  32.                 cout << sizeof(holdUsername);
  33.                 cout << "test";
  34.                
  35.         }
  36.        
  37.         //Enter Selection
  38.         cout << "\n\n Please choose format: 1 = Generic  2 = Specific  3 = Default \n\n Enter Selection now: ";
  39.         cin >> cselection;