Hi all, I need assist please. I read a text file that contains the strings that are unique / duplicate. I have to print the command line in the number of unique entries and write a single file of each word in the input file - each word to be on a separate line. Also I have to print the number of duplicate words and write the words duplicate output file - each entry into a different line. I've managed to open and read the file by using StreamReader ReadLine. Except that it's tough StreamWriter output. At the time that have been printed to the display of every line, but I want it to be written in the output file. How I can do this?
Code:
Is this the most excellent way to keep using StreamReader / Writer? Apparently, you need to write code to recognize DUP and unique words, but I just want to start by writing an output file and the console.Console::WriteLine("trying to open file {0}...", file);
// opens text file
StreamReader ^ inFile = File::OpenText(inputfile);
StreamWriter ^ outFile = File::CreateText(DupOutputFile);
String^ str;
int count = 0;
// retrieves each line
while ((str = inFile->ReadLine()) != nullptr)
{
count++;
Console::WriteLine("line {0}: {1}", count, str );
}
Bookmarks