Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的软件需要读取文件并写入设备。它应该将文件拆分为具有最大大小(例如 M 字节)的较小页面,并为每个周期设置页面地址。如何在 C 中实现它?
谢谢!
海蒂
目前尚不清楚您将如何处理这些数据,但要逐块读取文件,您只需要使用fread:
fread
FILE *file = fopen("yourfile.dat", "rb"); size_t amount; unsigned char buffer[PAGE_SIZE]; while ((amount = fread(buffer, 1, PAGE_SIZE, file)) > 0) { .. }