Hi all, I'm trying to convert a console application that I wrote in Codeblocks to a Windows Form application written in Visual Studio .NET 2003. I'm having trouble converting a piece of code that reads in a formatted text file line by line (the text in the file is always consistent). My code in 'traditional' C++ is
while (infile2 >> a >> b >> c1 >> d >> e >> f >> g1){
}
and my (current) code in Visual C++ is
if(openFileDialog1->ShowDialog() == DialogResult::OK){
// consider file.open method?
System::IO::StreamReader * sr = new
System::IO::StreamReader(openFileDialog1->FileName);
StreamReader* sr2 = File::OpenText(openFileDialog1->FileName);
String* s = S"";
while (sr2->ReadLine() >> a >> b >> c1 >> d >> e >> f >> g1 ) {
}
}
Should I not use streamreader? I only chose this as it seemed an easy way to open a file from an openfiledialog box which precedes this piece of code. Or is there another method I should be using? Thanks in advance :)