Wednesday, February 20, 2008

Errorrss


void readpage(char readfile[500]){
****fstream file(readfile[500],ios::in); *********
if( !file.is_open() ){
quit();
}
else{
for ( int x = 0; x < 20; x++ ){
file.getline (output, 500);
cout << output << "\n";
}
file.close();
cin.get();
}
}


This code is giving me the error of "invalid conversion from `char' to `const char*'" on the line that I starred.

It's being accessed by the line "readpage("welcomescreen.txt"); in the main program. So when I open the file it should be opening something called 'welcomescreen.txt' ... perhaps it can't use variables for file names?

Basically this accesses a file (welcomescreen.txt) reads 20 lines and prints them in succession. I had this working in main but decided to make a function out of it for simplicity...

Zhanar.... help? =D

Aside from all that, my finger has grown accustomed to pushing the ; button after I type every line;
I'm much more comfortable typing out code;
I can type code much more quickly now;
Provided I know what I want to type;

No comments: