|
-
January 17th, 2007, 09:15 PM
#1
I/O Problems
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
Code:
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
Code:
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
Code:
<< illegal for class
I tried to add as much detail as I could :S
Thanks for any help
Kieran
Last edited by C++...guy; January 17th, 2007 at 09:21 PM.
-
January 17th, 2007, 09:25 PM
#2
Re: I/O Problems
 Originally Posted by C++...guy
and made the transition for standalone .exe files.
Do you mean that you don't want to rely upon the .NET Framework? If that's the case then you should avoid Managed C++ (or C++/CLI).
- petter
-
January 17th, 2007, 09:42 PM
#3
Re: I/O Problems
Managed C++
Umm how do you write unmanaged code then?
Is it a different language altogether?
-
January 17th, 2007, 10:06 PM
#4
Re: I/O Problems
 Originally Posted by C++...guy
Is it a different language altogether?
Well, Managed/CLI is an extension to standard C++. There are both additions to the language itself, and you can utilize the .NET Framework.
 Originally Posted by C++...guy
Umm how do you write unmanaged code then?
When you create a new project you can choose between different project types. Such as 'Managed', 'MFC', 'Win32' etc.. To create a plain old standard non-visual project I would choose a 'Win32 Console Application'.
- petter
-
January 17th, 2007, 10:13 PM
#5
Re: I/O Problems
Noooo
So I basically lose the IDE 
Does this mean I have to use different code?
One more thing do I have to compile it differently to have it not rely on the .NET framework?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|