×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

A .net question about the document which was recommended by 雁影行洲 yesterday, please help, thanks!

// Write the remaining buffer.
bw.Write(outbyte, 0, (int)retval - 1);

In this line I can not understand why use "(int)retval - 1" here, but not "(not)retval", could anybody give me a hint? thanks.
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / A .net question about the document which was recommended by 雁影行洲 yesterday, please help, thanks!
    // Write the remaining buffer.
    bw.Write(outbyte, 0, (int)retval - 1);

    In this line I can not understand why use "(int)retval - 1" here, but not "(not)retval", could anybody give me a hint? thanks.
    • Maybe because outbyte is zero-based and retval is the size.
      • 谢谢,我理解retval不是数组的size,而是buffer里最后剩下的字节数,这也是为什么我不理解最后要把它减一。
    • still open...
      • This article might help.
        • 谢谢,就是根据这个文档,retval应该为actual number of bytes read,所以不理解为什么字节个数还减一,那不就少了一个字节?搞不懂了。