Answer the question
In order to leave comments, you need to log in
Why is the file size smaller than expected?
Good afternoon!
I'm trying to get the weight of a random file in 2 ways.
Method 1.
string filePath = @"C:\Users\User\Desktop\new.txt";
FileInfo fileInfo = new FileInfo(filePath);
Console.WriteLine(fileInfo.Length);
string filePath = @"C:\Users\User\Desktop\new.txt";
using(FileStream fs = new FileStream(filePath, FileMode.Open))
{
byte[] fileBytes = System.Text.Encoding.UTF8.GetBytes(filePath);
Console.WriteLine($"Вес массива байтов {fileBytes.Length}");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question