A
A
Alexey Maksimov2018-01-04 19:15:03
C++ / C#
Alexey Maksimov, 2018-01-04 19:15:03

How to determine that a file is fully downloaded via torrent?

There is a program in C ++, which checks the integrity of files by the size of the files, and if it is violated, then downloads the files via torrent. If you do not interrupt the download, then everything works fine. But if it is interrupted, then as a result, strange files will appear on the disk, which in the properties have a full size, but "on the disk" is only the part that managed to boot. The files are not fully loaded, the program does not work, but the check shows that all the files are in order, because boost::filesystem::file_size(file_path) gives a normal size. How to know the real size?
U77s2Mogls4.jpg
This is how one of the files that was created by the torrent looks like and has a normal size, but "on disk" is 0.
NA39zEyoqcc.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dark Hole, 2018-01-04
@additivex

You have encountered sparsed files. Here's how to determine their actual size
https://msdn.microsoft.com/en-us/library/windows/d...

S
Sergey, 2018-01-04
@edinorog

rehash. not?)

G
GavriKos, 2018-01-04
@GavriKos

which checks the integrity of the files by the size

Integrity is checked with a checksum. The size of a file does not in any way mean that the file has all the data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question