我需要将常规文件读取到内存中,我不知道它的大小,但我知道它小于 4096*1024*4 字节。
- 我可以读取(fd, addr, 4096*1024*4)吗?
- 实际上我已经做到了,所以我的系统调用读取的内容比我预期的要少。这是可预测的行为还是我应该在代码中查找错误?
最佳答案
There no limit to the amount you can read in one call, except that you need a big enough buffer and you can't read past the end of a file. – Ross Ridge 9 mins ago
我想通了,我只是需要更大的缓冲区。
关于linux - 如果我设置的计数大于我通过 read() 系统调用读取的文件大小怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30292214/