The binary file was written for a C++ application and it reads the file as chunks of objects. For e.g.,
class Reader {
int id;
int ratio;
int space;
float depth;
double width;
}
Now the binary file is being read as.
vector <Reader> vectorLists;
FILE * pFile;
Reader rd;
pFile = fopen ("reader.dat" , "r");
for ( /*until end of file, goes in a loop*/) {
if (pFile == NULL) perror ("Error opening file");
else {
if ( fgets (rd, sizeof(Reader) , pFile) != NULL )
vectorLists.push_back(rd);
}
}
Here it's reading a chunk of data based on the size of Reader class and assign that to a Reader object. Then this object is added to an array of Reader objects in a vector.
The task is to do the same in C#. i.e., how to read the same way into a C# class object? I know how to read a text file, but reading a binary as class objects is beyond my comprehension.