Click to See Complete Forum and Search --> : few questions


April 8th, 1999, 05:55 PM
Hello, I have done a course in VC++. I have been offered a project to be done in this language. The project is lie this. The format of certain data has to be changed to a different one to suit the needs and access it. The input file contains
pelvis
Chest
head
resultant
X-comp
Y-comp
Z-comp
0.00000E+00 (This indicates the time instant)
4.59 -8.68 1.582 -4.5
2.3 1.67 2.13 -1.386
3.944 -2.022 -2.24 -2.553
1.0000E-01
1.6 -1.8 1.402 -1.26
etc.
The format has to be changed to;
Time pelvis-res pel-x pel-y pel-z chest-res che-x che-y che-z ......
0.00 4.59 -8.68 1.58 -4.5 2.3 1.07 2.13 -1.386
1.0 1.6 -1.08 etc etc.......................
Please someone help me with this. I have a short deadline.

Remek Zajac
April 8th, 1999, 09:05 PM
Hmm,

Sorry, but the illustration you have given is totally unreadable, but regardless:

lets change the following format:
x y z
to
z y x

these are pure c functions:
fscanf(inputfile, "%i %i %i", &x, &y, &z);
fprintf(outputfile, "%i %i %i \n", z, y, x );

i'm not quite sure what to do with CR and NL (new line and carriage return)

perhaps this would work instead:
fscanf(inputfile, "%i %i %i %s", &x, &y, &z, &string );

do experiment.

good luck
rem

Dave Lorde
April 9th, 1999, 05:45 AM
As already mentioned, what you posted is unintelligible.

If you were converting it by hand, what are the steps that would take you from the input file to the output format?

Dave