Passing filename as a string
Hi, me again!
I have this code:
It works, but the fact that I need to take filename as a char* bugs me. Is there any way to get ifstream to accept a string as a file name?
char* getfilebits(char* filename)
ifstream file (filename, ios::in|ios::binary); // open file for reading
if (file.is_open()) // did it open?
ptr=new char; // make space for data
file.read(ptr, 16); //read data from file
file.close(); // close file, it is needed no longer
cout << "Could not open file" << endl;