Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# read large file

int filesize = (new FileInfo(filePath)).Length;            
using (Stream sr = File.OpenRead(filePath))
{
  int maxchunk = 1024;
    for(long x = 0; x < totalChunk; x++ )
    {
        long LefttotalLegth = filesize - (x * maxchunk);
        long leghtcopy = Math.Min(maxchunk, LefttotalLegth);
        byte[] chunkbyte = new byte[leghtcopy];        
        sr.Read(chunkbyte, 0, chunkbyte.Length);
       //Do something after read. like write to file
    }                           
}     
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# read all lines from filestream 
Csharp :: maclaurin series 
Csharp :: static c# 
Csharp :: how to minimum text length in textbox in c# 
Csharp :: cs string to enum 
Csharp :: How to type custom backcolor on c# winform 
Csharp :: mvc session key exists 
Csharp :: map user to ConnectionId SignalR 
Csharp :: how to type to console in unity 
Csharp :: select random from enum c# 
Csharp :: wpf clear grid 
Csharp :: input field to float unity 
Csharp :: how to set border for groupbox in c# 
Csharp :: selenium scroll to element c# 
Csharp :: how to show process time run c# 
Csharp :: c# ternary operator 
Csharp :: c# loop array 
Csharp :: c# arrow 
Csharp :: unity position ui element 
Csharp :: unity how to create a prefab 
Csharp :: get ad user using email address microsoft graph C# 
Csharp :: and operator in c# 
Csharp :: ontriggerenter 
Csharp :: viewBag as a list 
Csharp :: onmousedown() not working unity 
Csharp :: how to access asp button of gridview 
Csharp :: c# get random between 0 and 1 
Csharp :: c# sharepoint get users from column 
Csharp :: What are logic gates? 
Csharp :: C# traverseall elements in class property 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =