Hi guys,
>I'm working on a project that involves extracting the values from a file,that is in .npd format(this is not my problem) and then perform some calculations.
The file contains several columns of data(without any heading). I have to give each column a name, and do some calculations.
The raw file looks like :
1 $Abc 21:00:55 20 33 56 1 $Abc 21:00:56 22 34 56
2 $Abc 22:00:34 43 30 45 2 $Abc 22:00:35 44 36 45
3 $Abc 22:23:23 19 88 67 3 $Abc 22:23:24 12 82 63
4 $Abc 23:40:29 20 20 20 4 $Abc 23:40:30 26 26 24
5 $Abc 23:55:00 34 21 28 5 $Abc 23:55:01 37 26 29
1)I have to perform calculations on the 2nd, 3rd and 4th column and print it on a file with heading( Which I managed to do just now). for example add 1 to each value and give headings.
2)I have to delete the values starting from the 6th column!! I cannot use tokenise method, using "$" as delimiters because there are 2 columns starting with the symbol "$". And I want the values starting
The last6 columns must be completely removed.
Heading1 Heading 2 Heading 3
21 34 57
44 31 46
20 89 67
21 21 21
35 22 29
2) Then find the mean of each column.
Mean of column 1:
Mean of column 2:
Mean of column 3:
Also one of the columns contain 'N' and the column to be calculated is to the left of this column.
I know how to open the file, but sorting the data is a bit confusing, please help, Examples would be very helpful!!!
[Update]
I used this code to get the value from the 4th column, but I cannot make any calculations on these values. for example :
void main{
str(_T("%21:00:55 $GPGGA 210055 6102.00399 six"));
CAtlString resToken;
int curPos = 24;
double val;
resToken= str.Tokenize(_T(" "),curPos);
_tprintf_s(_T("Resulting token: %s\n"), resToken);
}
This prints the 4th column value but I have to do some calculation on that variable, For which I have to convert from string to double and back to string to print the values. Is this feasible?
[/Update]