CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: few questions

  1. #1
    Guest

    few questions

    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.




  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: few questions

    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


  3. #3
    Join Date
    Apr 1999
    Posts
    383

    Re: few questions

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured