Hi, I am supposed to write a program that reads the binary file timelog.dat and saves all data from the sensor A into the text file
A.txt. The rest of the data should be ignored.
This is what I came up with so far but I am not sure how to move forward.
Not clear from your description DataRecord.logger corresponds to multiple sensors.
If that's the case, then you need an if statement to test if DataRecord is from sensor A.
Your code reads only a single character from the file. Presumably, timelog.txt has multiple records, possibly from multiple sensors. Therefore you need to read complete DataRecords in a loop, test if from sensor A, and if true, write to A.txt.
Thanks for the hints, however, your code is full of mistakes once I try to run it.
I have tried to polish it but the errors keep popping up.
Perhaps you can provide a cleaner version?