C++...guy
January 17th, 2007, 08:15 PM
Hi all!
Im new to c++ but I used to use c# and made the transition for standalone .exe files.
Im working on a program that uses I/O and I get errors when trying to open, and write to a file with concatenated parameters.
E.g
ofstream file;
file.open("C:\\" + textBox->Text + ".txt");
file << textBox2->Text;
file.close();
The compiler has an error for the opening and writing line of my code.
The errors say
Cannot convert parameter 1 from 'System::String ^' to 'const wchar_t *'
"No user-defined-conversion operator available,
or Cannot convert a managed type to an unmanaged type"
and it also has an error that might be resolved with the first one
<< illegal for class
I tried to add as much detail as I could :S
Thanks for any help
Kieran
Im new to c++ but I used to use c# and made the transition for standalone .exe files.
Im working on a program that uses I/O and I get errors when trying to open, and write to a file with concatenated parameters.
E.g
ofstream file;
file.open("C:\\" + textBox->Text + ".txt");
file << textBox2->Text;
file.close();
The compiler has an error for the opening and writing line of my code.
The errors say
Cannot convert parameter 1 from 'System::String ^' to 'const wchar_t *'
"No user-defined-conversion operator available,
or Cannot convert a managed type to an unmanaged type"
and it also has an error that might be resolved with the first one
<< illegal for class
I tried to add as much detail as I could :S
Thanks for any help
Kieran