Buffered Stream and Streamreader C#

  • Thread starter Thread starter Akhil963
  • Start date Start date
A

Akhil963

Guest
I have a class Value the output of Value is used as an input to other classes and eventually in Main. In Main a logic is performed with first 512 bits and output is produced, after that I want my program to go back to 513th bit and rerun the logic in Main and keep returning till all the bits in file.txt is worked on. How can I do that?

public static byte[] Value()
{
byte[] numbers = new byte[9999];
using (FileStream fs = File.Open(@"C:\Users\file.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (BufferedStream bs = new BufferedStream(fs))
using (StreamReader sr = new StreamReader(bs))
{
string line;
while ((line = sr.ReadLine()) != null)
{
for (int i = 0; i < 512; i++)
{
numbers = Byte.Parse(line.ToString());
}
}
}
return numbers;
}


Continue reading...
 
Back
Top