doubt about data csv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <stdio.h>

#include <stdlib.h>



int main()

{

    FILE *p, *q; 
    double dados[11]; 
    char caracter[10];



    p = fopen("entrada.txt","r"); 
    q = fopen("saida.txt","w+"); 

    if (p == NULL) 
    {

        printf("Arquivo inexistente!\n");

    }



    else

    {

        while(!feof(p))


        {



            fscanf (p,"%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%lf%c%lf", &dados[0], &caracter[0], &dados[1], &caracter[1], &dados[2], &caracter[2], &dados[3], &caracter[3],&dados[4], &caracter[4],&dados[5], &caracter[5], &dados[6], &caracter[6], &dados[7], &caracter[7], &dados[8], &caracter[8], &dados[9], &caracter[9], &dados[10]);

             


            fprintf(q,"---------------------------------------------------------------\n");

            fprintf(q,"%lf \t %lf \t %lf \t %lf \t %lf \t %lf \t %lf \t %lf \t %lf \t %lf \t %lf\n", dados[0], dados[1], dados[2], dados[3], dados[4], dados[5], dados[6], dados[7], dados[8], dados[9], dados[10]);
            fprintf(q,"---------------------------------------------------------------");

        }

    }



    return 0;

}


This codex is good. But I wanted with an input like this:
500.0,5890,-4.5,-40.5,4,0.22,75,15,327.5,328.4,327.5

487.0,6092,-6.0,-39.4,5,0.26,105,18,328.1,329.1,328.2

467.0,6413,-8.4,-37.7,7,0.32,120,18,329.1,330.3,329.1

447.0,6749,-10.9,-35.9,11,0.40,95,16,330.1,331.6,330.1

423.0,7172,-14.1,-33.6,17,0.53,100,14,331.2,333.3,331.4

413.0,7355,-15.5,-32.6,22,0.60,85,11,331.8,334.1,331.9

400.0,7600,-17.3,-31.3,29,0.70,100,10,332.4,335.1,332.6

394.0,7713,-18.5,-32.5,28,0.64,105,11,332.3,334.7,332.4

389.0,7808,-18.7,-41.7,11,0.25,110,12,333.2,334.3,333.3

370.0,8180,-21.1,-36.1,25,0.48,191,10,334.9,336.7,334.9

368.0,8220,-21.3,-36.8,23,0.44,200,10,335.1,336.8,335.2

356.0,8462,-22.7,-41.2,17,0.29,190,10,336.4,337.6,336.5

343.0,8734,-24.2,-46.2,11,0.18,210,10,337.9,338.7,337.9

332.0,8972,-25.6,-50.5,8,0.11,240,3,339.2,339.7,339.2

328.0,9061,-26.1,-52.1,7,0.09,266,4,339.7,340.1,339.7

310.0,9465,-29.4,-54.1,7,0.08,25,10,340.6,341.0,340.6

300.0,9700,-31.3,-55.3,8,0.07,355,10,341.1,341.5,341.2

286.0,10030,-34.2,-56.9,8,0.06,335,10,341.6,341.9,341.6

273.0,10352,-37.1,-58.5,9,0.05,0,11,342.1,342.3,342.1

265.0,10557,-38.9,-59.5,9,0.05,345,9,342.3,342.5,342.3

250.0,10960,-42.5,-61.5,11,0.04,20,16,342.7,342.9,342.8

244.0,11125,-43.9,-62.9,10,0.03,20,23,343.0,343.2,343.0

242.0,11179,-44.3,-63.2,10,0.03,20,25,343.2,343.4,343.2

226.0,11632,-47.7,-65.9,10,0.02,25,10,344.9,345.0,344.9

217.0,11900,-49.7,-67.5,11,0.02,345,2,345.8,345.9,345.8

205.0,12277,-52.5,-69.7,11,0.02,245,10,347.0,347.1,347.0

200.0,12440,-53.7,-70.7,11,0.01,250,12,347.6,347.6,347.6

187.0,12863,-57.6,-72.3,14,0.01,255,15,348.0,348.1,348.0

173.0,13352,-62.1,-74.1,19,0.01,215,23,348.4,348.5,348.4

158.0,13904,-65.5,-76.9,19,0.01,215,11,351.7,351.8,351.7

150.0,14220,-67.5,-78.5,20,0.01,170,3,353.6,353.6,353.6

144.0,14465,-67.9,-78.9,19,0.01,355,2,357.0,357.1,357.0

139.0,14678,-68.3,-79.3,19,0.01,295,10,360.0,360.0,360.0

135.0,14850,-69.8,-80.5,20,0.00,245,16,360.3,360.3,360.3

120.0,15543,-76.1,-85.1,23,0.00,245,10,361.1,361.1,361.1

113.0,15891,-75.4,-84.8,22,0.00,285,10,368.6,368.6,368.6

104.0,16373,-74.5,-84.3,21,0.00,270,10,379.2,379.2,379.2

100.0,16600,-74.1,-84.1,20,0.00,225,3,384.3,384.3,384.3

87.3,17382,-79.5,89.5,18,0.00,20,8,388.7,388.7,388.7

81.0,17814,-77.2,-87.6,18,0.00,65,11,401.8,401.8,401.8

73.0,18413,-74.0,-85.0,17,0.00,60,11,420.6,420.6,420.6

72.2,18476,-73.7,-84.7,17,0.00,88,12,422.6,422.7,422.6

71.0,18576,-70.6,-82.6,15,0.01,130,13,431.4,431.4,431.4

70.0,18660,-67.9,-80.9,14,0.01,145,17,438.8,438.8,438.8

68.7,18773,-66.9,-79.9,14,0.01,151,20,443.3,443.4,443.3

68.0,18835,-67.3,-80.6,14,0.01,155,22,443.8,443.9,443.8

66.4,18978,-68.1,-82.1,12,0.01,151,18,445.0,445.1,445.0

66.0,19015,-67.3,-81.8,11,0.01,150,17,447.4,447.5,447.4

64.0,19203,-63.5,-80.3,9,0.01,170,15,459.8,459.9,459.8

63.8,19222,-63.1,-80.1,8,0.01,167,15,461.1,461.2,461.1

62.0,19398,-62.8,-81.3,7,0.01,135,10,465.6,465.6,465.6

60.2,19580,-62.5,-82.5,5,0.01,162,3,470.2,470.2,470.2

60.0,19600,-62.5,-82.6,5,0.01,165,2,470.5,470.6,470.5

58.0,19808,-63.0,-83.6,5,0.01,235,10,474.1,474.1,474.1

52.0,20479,-64.4,-86.8,3,0.00,220,27,485.8,485.9,485.9

50.0,20720,-64.9,-87.9,3,0.00,220,22,490.1,490.1,490.1

48.0,20968,-65.2,-88.2,3,0.00,225,20,495.1,495.2,495.1

44.0,21497,-65.9,-88.9,3,0.00,205,20,506.0,506.0,506.0

43.0,21637,-66.0,-89.0,3,0.00,180,10,508.9,508.9,508.9

42.7,21679,-66.1,-89.1,3,0.00,126,7,509.8,509.8,509.8

42.0,21781,-64.8,-88.2,3,0.00,0,0,515.3,515.4,515.3

40.0,22081,-61.1,-85.7,3,0.01,335,10,532.0,532.1,532.0

39.4,22174,-59.9,-84.9,2,0.01,326,8,537.2,537.3,537.2

39.0,,,,,320,7,,,

the code output as well, Not exactly so because the numbers are not the same but wanted it to be in table format with a blank space where data had not:

 1013.0     11   25.0   21.3     80  16.02    180      5  297.1  343.5  299.9
 1009.0     46   25.2   17.2     61  12.38    175      9  297.6  333.7  299.8
 1000.0    125   24.6   16.6     61  12.02    165     18  297.8  332.9  299.9
  986.0    247   23.5   15.9     62  11.63    155     25  297.9  331.9  299.9
  925.0    802   18.6   12.6     68  10.00    145     29  298.3  327.7  300.1
  903.0   1008   16.6   12.6     77  10.25    142     29  298.3  328.4  300.2
  872.0   1305   14.6   11.6     82   9.93    138     28  299.2  328.5  301.0
  850.0   1521   13.2   10.0     81   9.15    135     28  300.0  327.1  301.6
  826.0   1762   12.4    5.4     62   6.85    133     27  301.6  322.3  302.8
  798.0   2050   10.5    8.0     84   8.48    130     25  302.5  328.0  304.1
  788.0   2156    9.8    8.9     94   9.16    134     24  302.9  330.4  304.6
  772.0   2326    9.3    8.1     92   8.83    140     23  304.2  330.9  305.8
  767.0   2380    9.2    7.8     91   8.73    138     22  304.6  331.0  306.2
  754.0   2522    9.2    5.0     75   7.30    134     21  306.1  328.5  307.4
  745.0   2622   11.8  -27.2      5   0.56    131     20  309.9  311.9  310.1
  740.0   2679   12.8  -31.2      3   0.38    129     20  311.6  313.1  311.7
  700.0   3143   11.6  -37.4      2   0.22    115     15  315.3  316.1  315.3
  694.0   3215   11.7  -37.3      2   0.23    110     14  316.2  317.1  316.2
  689.0   3275   11.8  -37.2      2   0.23    113     14  316.9  317.8  317.0
  672.0   3481   10.4  -37.0      2   0.24    125     14  317.7  318.6  317.7
  630.0   4014    6.8  -36.6      3   0.27    105     13  319.5  320.5  319.6
  616.0   4199    5.6  -36.4      3   0.28    110     12  320.1  321.2  320.2
  590.0   4546    2.4  -32.9      5   0.41    160     13  320.4  322.0  320.5
  541.0   5241   -3.9  -25.9     16   0.86    212     12  320.9  324.1  321.1
  516.0   5613   -5.5  -22.5     25   1.22    241     11  323.4  327.8  323.6
  509.0   5720   -5.9  -15.9     45   2.19    249     11  324.1  331.8  324.6
  506.0   5767   -6.1  -23.1     25   1.18    253     11  324.4  328.7  324.7
  500.0   5860   -6.7  -22.7     27   1.24    260     11  324.8  329.3  325.1
  495.0   5938   -7.1  -16.1     49   2.21    267     10  325.2  333.0  325.7
  479.0   6191   -9.1  -15.6     59   2.38    290      8  325.9  334.2  326.4
  470.0   6337  -10.2  -15.3     66   2.49    320      6  326.3  335.0  326.8
  449.0   6689  -12.9  -14.6     87   2.76    332      7  327.1  336.8  327.7
  429.0   7034  -15.3  -17.8     81   2.21    344      8  328.4  336.2  328.8
  422.0   7158  -15.1  -23.1     50   1.42    348      9  330.2  335.4  330.5
  419.0   7211  -15.3  -24.4     46   1.28    350      9  330.6  335.3  330.8
  411.0   7356  -15.9  -27.8     35   0.95    355     12  331.7  335.2  331.9
  400.0   7560  -16.7  -32.7     24   0.61      0     19  333.2  335.6  333.3
  395.0   7655  -16.1  -49.1      4   0.11      1     22  335.2  335.6  335.2
  382.0   7907  -17.1  -44.1      8   0.20      4     29  337.1  337.9  337.1
  376.0   8025  -18.2  -44.4      8   0.20      5     32  337.2  338.0  337.2
  338.0   8814  -25.3  -46.3     12   0.18    325     28  337.9  338.6  337.9
  312.0   9388  -30.0  -54.4      7   0.08    295     25  339.2  339.5  339.2
  300.0   9670  -32.3  -58.3      6   0.05    290     27  339.7  340.0  339.8
  258.0  10708  -42.1                         273     34  340.3         340.3


What is missing in my code?
use the strtok function to read the delimit values and read the values

strtok( str, delims );
Topic archived. No new replies allowed.