Help Please. Error Message.

I'm making the password program thing (or at least editing it). I had some good help from people, the last post I made. They taught me some new good commands, but anyway. The code I have wont' work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
 {
    string szUsername;
    int SIZE = 100;
   char chNewUsername[SIZE];
    string line;
    string szNewPassword;
    string szPassword;
    cout << "Type in your username.\n                                -";
    cin  >> szUsername;

    if (szUsername == "new" || szUsername == "New" || szUsername == "update" || szUsername == "Update")
    {
        system("cls");
        cin.clear();
        ofstream WriteFile;
        cout << "Type in your username or type in a new one.\n                                      -";
        cin  >> chNewUsername;

        system("cls");
        cout << "Type in your new password.\n                  -";
        cin  >> szNewPassword[SIZE];



    WriteFile.open(chNewUsername);
    WriteFile << szNewPassword;
    WriteFile.close();











  }


else{
cin.clear();
  cin  >> szUsername;




  ifstream ReadFile (szUsername);
  if (ReadFile.is_open())
  {
    while ( ReadFile.good() )
    {
        system("cls");
      getline (ReadFile,line);
      cout << "Type your password.\n                   -");
      cin  >> szPassword;
      if(szPassword == line)
      {
          system("cls");
          cout << "Correct";
          Sleep(200)
          return;

    }
    ReadFile.close();



}  ;
else{
    system("cls");
    cout << "Wrong Password";
    system("pause>nul");
};
  }
 }



Here are the errors:

G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp||In function 'int main(int, char**)':|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|57|error: no matching function for call to 'std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(std::string&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\i386-pc-mingw32\4.4.0\..\..\..\..\include\c++\4.4.0\fstream|442|note: candidates are: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\i386-pc-mingw32\4.4.0\..\..\..\..\include\c++\4.4.0\fstream|428|note:                 std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char, _Traits = std::char_traits<char>]|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\i386-pc-mingw32\4.4.0\..\..\..\..\include\c++\4.4.0\iosfwd|86|note:                 std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(const std::basic_ifstream<char, std::char_traits<char> >&)|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|64|error: expected ';' before ')' token|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|70|error: 'Sleep' was not declared in this scope|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|71|error: expected ';' before 'return'|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|79|error: expected '}' before 'else'|
||=== Build finished: 5 errors, 0 warnings ===|

Last edited on
I get the Sleep, I forgot to put #include <windows.h>
I've got the errors down to this:
1
2
3
4
5
6
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp||In function 'int main(int, char**)':|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|60|error: no matching function for call to 'std::basic_ifstream<char, std::char_traits<char> >::open(std::string&)'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\i386-pc-mingw32\4.4.0\..\..\..\..\include\c++\4.4.0\fstream|495|note: candidates are: void std::basic_ifstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|65|error: expected ';' before ')' token|
G:\Flash drive\C++ Programs\Drue Made\Read a text file\main.cpp|72|error: return-statement with no value, in function returning 'int'|
||=== Build finished: 3 errors, 0 warnings ===|

Topic archived. No new replies allowed.