So I write a log file containing 16 bit integer data. Using the following way.
std::ofstream waveform;
waveform.open("waveform.iq");
cout << "Opening file for waveform " << endl;
LOOP WRITING BUFFER VALUES TO THE FILE
waveform << R0 << std::endl; // Write Sample
LOOP END
waveform.close();
At the end I have an iq file containing samples like
0
16343
30000
.....
And so on.
How do I read this long file in such a way that I take blocks of 8192 samples once in an array and then again until the whole file ends. If at the end the file does not have sufficient samples to fill 8192 samples then it repeats the waveform.
Can I implement this reading of file using vector class ?
Is writing done in an efficient manner ?
Thank YOu.