gpt4 book ai didi

c++ - WriteFile lpNumberOfBytesWritten 小于 nNumberOfBytesToWrite

转载 作者:可可西里 更新时间:2023-11-01 13:25:45 24 4
gpt4 key购买 nike

当调用 WriteFile 时,返回的 lpNumberOfBytesWritten 是否可以在未发生错误的同步写入模式下小于 nNumberOfBytesToWrite(返回为 )?写入到适当的文件(不是套接字、管道或其他特殊句柄)。 lpOverlapped 未使用。

docs 中并不完全清楚.

最佳答案

文档指出:

The WriteFile function returns when one of the following conditions occur:

  • The number of bytes requested is written.
  • A read operation releases buffer space on the read end of the pipe (if the write was blocked). For more information, see the Pipes section.
  • An asynchronous handle is being used and the write is occurring asynchronously.
  • An error occurs.

只有其中第一个符合您的标准,所以答案是文档很清楚 *lpNumberOfBytesWritten 总是等于 nNumberOfBytesToWrite 当函数在您调用时返回指定。

关于c++ - WriteFile lpNumberOfBytesWritten 小于 nNumberOfBytesToWrite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5429434/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com