Hello there,
I must admit, I'm TERRIBLE with filetypes. I remember the earlier days, where if I had a char to char* error or something similar, I'd just throw * or & operators in and hope something would work. Well, I'm not much better now.
My problem is this : I'm using #define to define a value of text ( a filename ), and I want the program to check for this. If it ISN'T declared, it'll ask the user for input. Code goes like this :
Code://////// PRINT INPUT TO FILE void Encryptor::printinputfile() { #ifdef OUTFILENAME strcpy(filename.c_str(), OUTFILENAME); // Where filename is a string #else cout << "\nFilename >> "; cin >> filename; cout << endl; #endif fout.open(filename.c_str(), ios::binary); fout << input; fout.close(); }
I'm getting "invalid conversion from const char* to char*" on the line that calls strcpy.
So, is there a better / more intelligent way to do this ? Also, how would I solve this problem above ?
Thanks very much,
Quentin