I am relatively new to C++ language and want to use byte reading(using fstream,ifstream,ofstream) objects to read what is given in input.dat file and the structure of a file is header in first 4 bytes and then afterwards a quote or trade(dynamic byte size) which are have to be used to extract data and and printing to console. I am attaching a picture to make it more clear
Image gives idea about the header
Now, as we can see that we can make a struct like
struct Header{
short int pack_len;
short int num_updates;
};
The problem I face is that even I have been through threads on cppreferences I did not get answer how can I strip data directly from .dat file and put it to Header Attributes
Now, I have tried read method and << operator to write in text file but to no avail. I have no idea how to put read data to struct attributes. Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire