C# BinaryReader ReadInt64
Description
BinaryReader ReadInt64
Reads an 8-byte signed integer
from the current stream and advances the current position of the stream by
eight bytes.
Syntax
BinaryReader.ReadInt64
has the following syntax.
public virtual long ReadInt64()
Returns
BinaryReader.ReadInt64
method returns An 8-byte signed integer read from the current stream.
Example
using System;//from w w w. j a v a 2 s . c o m
using System.IO;
class ConsoleApplication
{
const string fileName = "data.dat";
static void Main()
{
using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
{
writer.Write((Int64)10);
}
using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
{
Console.WriteLine(reader.ReadInt64());
}
}
}
The code above generates the following result.