Reading a binary file by bytes


Does the ProjectWise API allow reading a sequence of bytes from a specified position from a binary file?

I need the following analogue to reading windows files:

long position = 100;
int count = 50;
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(System.IO.File.Open("File.bin", System.IO.FileMode.Open));
binaryReader.BaseStream.Position = position;
byte[] bytes = binaryReader.ReadBytes(count);

  • System.IO.BinaryReader is based on .NET technology, but PW API is based on native code C++. So to implement same thing, you can use 

    FILE* pMyFile = aaApi_FileOpen (L"File.bin", L"rb+");

    Here, open mode "rb+" means open a file as ReadOnly and Binary. Prefix L before a character string means this string is using Unicode.

    Please see more information about C++ fopen function for subsequent usage.