Answer the question
In order to leave comments, you need to log in
C# How to read from file, first 1000 bytes into byte array?
Good afternoon
There is a code which reads out all file.
public static void SelectFile(string file)
{
byte[] bytesToBeEdit = File.ReadAllBytes(file);
// Тут_творим_с(файлом, чтохотим);
}
Answer the question
In order to leave comments, you need to log in
byte[] bytes = new byte[1000];
using(var stream = File.OpenRead(fileName))
{
int count = stream.Read(bytes, 0, 1000);
}
var fileInfo = new FileInfo(fileName);
int chunkSize = fileInfo.Length / 10;
byte[] bytes = new byte[chunkSize];
using(var stream = fileInfo.OpenRead())
{
int count = stream.Read(bytes, 0, bytes.Length);
}
https://msdn.microsoft.com/en-us/library/system.io...
In the example below, everything is there
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question