I don't read big data text file. My file approx size 2GB. However, themaximum file size I read was 200MB. This How to do this in C#. Help me guys.
private void button12_Click(object sender, EventArgs e)
{
String file = textBox1.Text;
if (string.IsNullOrEmpty(file))
{
MessageBox.Show("Файлыг заана уу!!");
}
else
{
System.IO.FileInfo fi = new System.IO.FileInfo(file);
System.IO.FileStream fs = new System.IO.FileStream(file, System.IO.FileMode.Open);
int bufferSize = 500000000; // file size
using (System.IO.BufferedStream bs = new System.IO.BufferedStream(fs, bufferSize))
{
byte [] buffer = new byte [bufferSize];
int readLength;
do
{
readLength = bs.Read(buffer, 0, bufferSize);
richTextBox1.Text += System.Text.Encoding.ASCII.GetString(buffer);
Application.DoEvents();
} while (readLength == bufferSize);
bs.Close();
}
fs.Close();
}
String names = richTextBox1.Text;
}