Hi all,
1) In a little project I'm working on, I read a file, extract values, process them and output the final result. But this file format is not consistent.
i.e, The files are from a seabed survey, consisting of latitude, longitude, height, and GPS values. Sometimes there are 2 GPS's values and sometimes there is just one.
But all these files contain default variables that are used for calculations. How can I make this program consistent? Because, I have to change the swscanf function every single time, I have to read a different file format.
2) Another question :- As the calcultions involve calculations of mean I have to open the file many times, ie I have to read the file from first to last row many times,
1) After the first read- Calculate Total, count;
2) In the second read - Use the average value for some calculations on every line in the file and output.
3) After third do some calculations involving from values obtained from the previous step...
I read my file 3 times plus 1 (initially to get the start time and end time). Is there a way to get rid of this and make it simpler?
Note:
The file size varies from 320 KB to 2100 KB. The format:-
With 2 GPS
Type 1:
21:00:55.035,$GPGGA,210055.00,6102.0039902,N,00107.5920998,E,2,09,1.2,23.57,M,47.57,M,10.0,1011*4E,$GPGGA,210054,6102.00388,N,00107.62266,E,2,10,1.0,025.33,M,047.57,M,13,0777*76,$HEHDT,000.4,T*2B,0.67,
Type 2: 16:39:09 $GPGGA 163908 5838.966652 N 131.910585 E 2 9 0.8 67.4 M 0 M 8.4 1006*42 $GPGGA 163909 5838.94843 N 131.89993 E 1 10 0.8 22.77 M 46.33 M 0000*78 $HEHDT 292.3 T*25 293
With 1 GPS
Type 3:$GPGGA,140823.00,7434.7372191,N,05713.8933749,W,1,06,1.2,48.77,M,21.98,M,,*4E
Type 4:$GPGGA,154349.00,7434.7372530,N,05713.8941497,W,2,07,1.7,45.04,M,21.98,M,45.2,0081*5C,
Even the time format is different, For the first one I can output as it is but for the type 3 I got to format and then display as I use them for plotting graphs.