I'm trying to divide a file into an x ammount of blocks of size y (in bytes), so that I can copy each block individually. How can I do that?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
To read 1024 chars into the buffer:
You do the rest.
Try using fread
Each time you read ysize bytes in buffer from the file.
Some struct stat structures have additional members in them that prove useful when copying files:
If the block size you read is an even multiple of st_blksize you tend to get more efficient reading of the file.
Failing st_blksize, <stdio.h> provides a BUFSIZ macro for buffer size.