×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

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,所以不理解为什么字节个数还减一,那不就少了一个字节?搞不懂了。