Are trying to do this using Managed Extensions? If yes then you can use the System::IO::StreamReader to read in the file and then assign it to a variable:
Code:
String* str; //string variable
System::IO::StreamReader* reads = new System::IO::StreamReader(S"hello.txt");
//new instance of StreamReader
str = reads->ReadToEnd(); //read the whole file using the ReadToEnd() method
reads->Close();
Originally posted by mutant Are trying to do this using Managed Extensions? If yes then you can use the System::IO::StreamReader to read in the file and then assign it to a variable:
Code:
String* str; //string variable
System::IO::StreamReader* reads = new System::IO::StreamReader(S"hello.txt");
//new instance of StreamReader
str = reads->ReadToEnd(); //read the whole file using the ReadToEnd() method
reads->Close();
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.