Backends/SiaNet.Backend.Torch/FileOperations.cs
/// <summary>
///   Read bytes from the file into the given byte array.
/// </summary>
/// <param name="data">An array to place the data in after reading it from the file.</param>
/// <param name="n">The maximum number of bytes to read.</param>
/// <returns>The number of bytes read.</returns>
Read bytes from the file into the given byte array.
Read bytes from the file into the given byte array .
public long ReadBytes(byte[] data, int n)
        {
            if (n < 0)
                throw new ArgumentOutOfRangeException("n cannot be less thab zero");
            if (n > data.Length)
                throw new ArgumentOutOfRangeException("n cannot be greater than data.Length");
            unsafe
            {
                fixed (byte *dest = data)
                {
                    var readItems = THFile_readByteRaw(this.handle, (IntPtr)dest, n);
                    return readItems;
                }
            }
        }
public long ReadBytes ( byte [ ] data , int n ) { if ( n < 0 ) throw new ArgumentOutOfRangeException ( " " ) ; if ( n > data . Length ) throw new ArgumentOutOfRangeException ( " " ) ; unsafe { fixed ( byte * dest = data ) { var readItems = THFile_readByteRaw ( this . handle , ( IntPtr ) dest , n ) ; return readItems ; } } }
Read bytes from the file into the given byte array.
Read bytes from the file into the given byte array .
The number of bytes read.
The number of bytes read .
data
byte[]
An array to place the data in after reading it from the file.
An array to place the data in after reading it from the file .
n
int
The maximum number of bytes to read.
The maximum number of bytes to read .