D
dgleeson3
Hello All
I have a txt file of strings of different lengths.
I dont know how many strings are in the file.
I have no problem reading the file and sending to the console (as
below).
To store the strings read, in a buffer, I had decided to use an array
of strings.
However I must know the array size in c# unlike in C++.
Ho do I read the strings (of unknown number) into a buffer?
I will be able to specify a reasonable maximum number of strings in
the file.
using (StreamReader sr = new StreamReader(path))
{
String line;
// Buffer index
//int i=0;
// Read and display lines from the file
until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
// Data_Buffer[0] = line;
//i++;
Console.WriteLine(line);
}
}
} // if
Many thanks for any help.
Regards
Denis
_____________________
http://www.CentronSolutions.com
I have a txt file of strings of different lengths.
I dont know how many strings are in the file.
I have no problem reading the file and sending to the console (as
below).
To store the strings read, in a buffer, I had decided to use an array
of strings.
However I must know the array size in c# unlike in C++.
Ho do I read the strings (of unknown number) into a buffer?
I will be able to specify a reasonable maximum number of strings in
the file.
using (StreamReader sr = new StreamReader(path))
{
String line;
// Buffer index
//int i=0;
// Read and display lines from the file
until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
// Data_Buffer[0] = line;
//i++;
Console.WriteLine(line);
}
}
} // if
Many thanks for any help.
Regards
Denis
_____________________
http://www.CentronSolutions.com