char to string?
How would I do something like this:
This compiles without any errors/warnings BUT when I run it, it says the program has had an error and will now close...
ifstream getFileName ("aFile.ini");
file1_len = strlen(en_file1);
for (int i = 0; i < file1_len; i++)
de_file1[i] = en_file1[i];
basically I need somthing that will convert a character to a string.
There seems to be no reason at all for you to even worry about this. Just use a std::string and forget about it, don't even convert.
well, I think i forgot to mention some things.
1. I am using this program to decrypt/encrypt files...
2. getFileName.getline... requires a character array to work, strings return an error while compiling
3. i wrote a function that encrypts/decrypts these files but only uses strings [encrypt(string, string string&);]
im in quite a bit of a issue here :(
There should be an implicit conversion if you pass a char array to a function that expects a std::string. That said, you can use the non-member getline function instead: