- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用VC++函数
ReadFile(FileHandle,charBuf,noOfBytesToRead,&noOfBytesRead,NULL);
在for循环内;在 foor 循环的每次迭代中,FileHandle 在文件中向前移动,即在每次迭代中,我们正在读取文件的特定单元并将文件中的数据单元(文件中的数据束)复制到 char *
数组。
每次迭代中要读取的数据量(从文件到 char *
数组)由“noOfBytesToRead”决定。
对于某些 no: of 迭代,ReadFile() 工作正常,但我观察到对于某些“第 n”次迭代(在读取第 n 组数据时),第 4 个参数 (noOfBytesRead) 在即使 ReadFile() 返回 1,上述调用也设置为 0。
ReadFile() 的返回值为 1,表示成功,第 4 个参数“noOfBytesRead”设置为 0,而不是 no: of bytes Read。这是矛盾的!为什么会这样?
任何人都可以在这方面帮助我。 ReadFile() 是一个 Win API,我什至无法进入代码进行进一步调试。
最佳答案
来自 MSDN :
If the return value is nonzero and the number of bytes read is zero, the file pointer was beyond the current end of the file at the time of the read operation.
关于c++ - ReadFile() 返回 1, "lpNumberOfBytesRead"设置为 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9173272/
我正在学习 C,我想知道我需要在 WriteFile 和 ReadFile 方法中为这些值添加什么 lpNumberOfBytesRead 和 lpNumberOfBytesWritten Write
我似乎无法在我的 C# 应用程序和 C++ 应用程序之间创建管道。我的 C++ 应用程序是一个 dll,它被注入(inject)到某个程序中,然后打开连接到我的 C# 应用程序的管道。 我的问题?在
来自 ReadProcessMemory in MSDN: lpBaseAddress [in]: 指向要从中读取的指定进程中的基地址的指针。在发生任何数据传输之前,系统会验证指定大小的基地址和内存中
我正在使用VC++函数 ReadFile(FileHandle,charBuf,noOfBytesToRead,&noOfBytesRead,NULL); 在for循环内;在 foor 循环的每次迭代
我对 SetFilePointerEx、ReadFile 和 WriteFile API 感到有些困惑。比如说,如果我想将文件指针移动到一个新位置,这样做是否足够: if(SetFilePointer
我是一名优秀的程序员,十分优秀!