there is fstream in normal C++ that allows you to do file i/o
but how do i do this in managed C++ in a forms application?
i read about a config file but i dont quite get it..
thnx.
there is fstream in normal C++ that allows you to do file i/o
but how do i do this in managed C++ in a forms application?
i read about a config file but i dont quite get it..
thnx.
It's been a while since I used managed C++, but I think it was something like:
System::String ^ name = "something.txt";
System::IO::FileStream ^ fs = System::IO::File::Open(name,System::IO::FileMode::Open);
// Do stuff
fs->Close();
But I could be wrong.
ahh thnx. lemme try that :)
it works except idk how input and output.. i tried using the system:: things but no luck in finding out how..
ok i figured out how to input it into the file but a problem remains...
this is what i have got
using namespace System;
using namespace System::Ios;
using namespace System::Ios::Text
void AddText( FileStream^ fs, String^ value )
{
array<Byte>^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
fs->Write( info, 0, info->Length );
}
String ^b1Text = button1->Text + "\n";
FileStream ^fs = File::Open(weblinkFile, FileMode::CreateNew|FileMode::Open);
AddText(fs, b1Text);
AddText(fs, button2->Text);
but the thing is that instead of making another line it gives me "Button 1" followed by this weird rectangle shape and then "Button 2" on the same line.
how can i make things come on a new line in the file while using
button1->text
in there.. cuz i can replace button1->text with "Hello World \n" and it creates a new line but it's a probem cuz there's no " " in button1->Text
is there any other way to create a new line using a string in the 2nd param?
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.