How can I read specific data columns from a file in c -


Good day all,

I am beginning to debut in C programming. I have this problem and

My problem is as follows:

I have a series of files with an extension (.msr) in which they are decimal, which is time, time, The numerical values ​​of temperature, pressure, .... which are different from the cm colon, to more, are measured. Examples of data values ​​are shown below.

  2010-03-03 15:55:06; 8.01; 24.9; 14.52; 0.09; 84; 12.47; 2010-03-03 15:55:10; 31.81; 24.9; 14.51; 0.08; 82; 12.40; 2010-03-03 15:55:14; 45.19; 24.9; 14.52; 0.08; 86; 12.32; 2010-03-03 15:55:17; 63.09; 24.9; 14.51; 0.07; 84; 12.24;  

Each file is named as a name REG_2010-03-03, REG_2010-03-04, REG_2010-03-05, ... and they all are contained in one file.

  1. I want to remove date information from each file which in this case 2010-03-03, column 3 and column 6

  2. Find statistical means of each column of 3 and 6.

  3. Then store the results in a new file, which contains only the date, and for the further analysis, the calculated mean of the columns given above.

They have to be written in C.

I'm actually counting it or your help

Here is a starting point:

/ P>

  #include & lt; Stdio.h & gt; #include & lt; String.h & gt; # Include & lt; Stdlib.h & gt; Int main (int argc, char ** argv) {char str [] = "2010-03-03 15:55:06; 8.01; 24.9; 14.52; 0.09; 84; 12.47;"; Four * date, * tmp; Double meaning = 0; Int i; Date = strotok (str, ""); Strtok (NULL, ""); // Leave on time (tmp = strtok (NULL, ";")) {++ i; If (i == 3 || I == 6) {// only 3 and 6th value mean = = strode (tmp, null); }} Mean / = 2; Printf ("% s:% .2f \ n", date, mean); Return 0; }  

You have to do something for each line.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -