The offset and length exceed the limit of the array, or the count is greater than the ending point from the index to the source set.

Source: Internet
Author: User

 Error scenarios:

Open a file using the filestream object and want to read it in the cache. Because the cache size is 1 kb, you need to read it in multiple times. However, when using the filestream. Read () method,

Error code:

Byte [] sendbuf = new byte [m_nblocksize];
Int nread = readfile. Read (sendbuf, noffset, m_nblocksize );

When noffset = 1, an error is always thrown: the offset and length exceed the limit of the array, or the count is greater than the ending point from the index to the source set.

Error cause:

The meaning of each parameter is not clear.

Filestream

Public override int read (byte [] array, int offset, int count)

Where:

Array

Type: array <system...:. byte> [] () []

This method contains the specified byte array, and the offset and (Offset + count-
1) The value is replaced by the byte read from the current source.

Offset

Type: system...:. int32

The Byte offset in array, where the byte is read.

Count

Type: system...:. int32

The maximum number of bytes read.

At the beginning, the error indicates that offset is a cheap file stream, which leads to this error.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.