0

Hello,
I am having a problem to call a function
I am posting the code...
Can anyone help how we can solve the problem...

int AES(string path1, string path2)
{
        ifstream myfile1 (path1, ios::binary);// error
	ofstream myfile3  (path2, ios::binary);//error
}

int main()
{
    AES( "c:/plaintext.txt" , "c:/cipheretxt.txt" );
    return 0;
}
3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by kartouss
1

The filename parameter has to be a C-style string:

ifstream myfile1 (path1.c_str(), ios::binary);
ofstream myfile3  (path2.c_str(), ios::binary);
Votes + Comments
Very Helpful
0

fstream parameters require const char*, not string. So pass the c_str() method ifstream myfile1 (path1.c_str(), ios::binary) [edit]^^^ what Narue said.[/edit]

0

Thanks Ancient Dragon and Narue...
Thats solved the problem..
You people are very helpful keep the thread going on...Good luck..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.