Hello,
I just found that the code works with old text files but not with the
new ones.
The code:
char Line[4][200], *ctmp;
Int_t i
.
.
.
for (i=0;i<4;i++) // i<6 reduced to i<4 since
{ // only for lines with data for each event
fgets (Line[i], 199, fin);
printf ("%d: /%s/\n", i, Line[i]);
ctmp = strrchr (Line[i], '\n');
*ctmp = 0;
}
file 1 (working)
====================
19.05.1999 16:38 Uhr
0 1.000000 40.000000 40.000000 1.750000 103.500000 106.400000
108.400000 99.600000 0
75 25 4351.747464 169.749000 4370.416641 61.035629
208 25 10675.206564 -280.789516 10615.483903 -137.398180
19.05.1999 16:40 Uhr
1 0.000000 40.000000 40.000000 1.750000 103.500000 106.400000
108.400000 99.600000 0
75 25 4372.466790 178.117624 2511.927466 63.932411
208 25 10779.329067 -283.178774 10773.783207 -138.049098
19.05.1999 16:50 Uhr
2 4.000000 40.000000 40.000000 1.750000 103.500000 106.400000
108.400000 99.600000 0
75 25 4401.120735 171.148528 4399.890736 61.358194
208 25 10727.505825 -265.992060 11533.359946 -130.553110
19.05.1999 16:53 Uhr
3 4.000000 40.000000 40.000000 1.750000 103.500000 106.400000
108.400000 99.600000 1
75 25 4084.020264 294.414557 4031.374977 88.038480
208 25 11078.011014 -306.585555 10999.495482 -92.667140
19.05.1999 17:01 Uhr
4 0.000000 40.000000 40.000000 1.750000 103.500000 106.400000
108.400000 99.600000 1
75 25 4089.338339 297.399561 3996.689840 88.485029
208 25 11107.414087 -245.536366 11109.918239 -67.067850
19.05.1999 17:12 Uhr
5 0.000000 20.000000 15.500000 1.750000 108.900000 110.900000
113.000000 104.700000 1
75 25 4070.847819 302.518123 4083.002473 91.158164
208 25 11040.040218 -261.976085 11228.250998 -69.677470
====================
file 2 (not working)
====================
24.11.1999 14:46 Uhr
0 0.000000 300.000000 11800.000000 6.060000 0.000000 0.000000 0.000000
0.000000 0
53 25 3518.915765 -12.759758 3528.118331 -2.619025
195 25 0.00000 0.000000 0.00000 0.000000
24.11.1999 15:46 Uhr
1 0.000000 200.000000 4500.000000 6.060000 32.804681 36.069023
31.767028 28.098742 0
53 25 3538.190581 -249.798066 3538.087533 -27.432829
195 25 0.00000 0.000000 0.00000 0.000000
24.11.1999 15:49 Uhr
2 1.000000 200.000000 4300.000000 6.060000 31.430782 34.657509
30.321846 26.666945 0
53 25 3516.999586 -233.146991 3516.869163 -25.709281
195 25 0.00000 0.000000 0.00000 0.000000
24.11.1999 15:56 Uhr
3 2.000000 200.000000 4300.000000 6.060000 30.578457 33.320395
29.344905 25.752535 0
53 25 3491.668476 -252.445214 3491.529496 -27.763021
195 25 0.00000 0.000000 0.00000 0.000000
24.11.1999 15:57 Uhr
4 2.000000 300.000000 8800.000000 6.060000 37.443463 39.752789
34.672330 31.039665 0
53 25 3509.489705 -216.538263 3509.283206 -23.883268
195 25 0.00000 0.000000 0.00000 0.000000
24.11.1999 16:00 Uhr
5 2.000000 350.000000 14000.000000 6.060000 38.590848 41.445488
35.689402 32.044243 0
53 25 3508.459410 -199.534426 3508.527873 -21.996360
195 25 0.00000 0.000000 0.00000 0.000000
====================
the line seperator is for both text files „\r\n“ or 0x0d 0x0a, the DOS
newline
characters.
what is the difference. For file 1 fgets reads until first occurence
of newline
whereas in file 2 fgets reads the allowed 199 characters reading over
2 newlines.
Cheers Stephan Heising
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET