#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    District of Columbia
    Posts
    16
    Rep Power
    0

    Need help printing an array from a text file


    Hello again.

    I need a quick bit of help printing an 3x3 array (stored on a text file) which is part of a structure. I have developed the following:

    [code]
    {
    fscan(myfile, "%i %i %i", &var[i][0], &var[i][1], &var[i][2]);
    }
    .....
    for(i=0;i<3;i++){
    fprintf("VARIABLES | %i %i %i\n", var[i].name);
    fprintf("%i", var[0].name);
    fprintf("%i", var[1].name);
    fprintf("%i", var[2].name);
    }
    [code]

    Am I on the right track?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    95
    Rep Power
    11
    I have a similar problom, I have a text file with a list of numbers and I have to turn it into a 2d array. Did you ever get any answers? if so could you help me!
    Thanks
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    95
    Rep Power
    11
    ya, could you explain
  6. #4
  7. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    gtg dude, i'll do it later :D
  8. #5
  9. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    Do you even look at the other posts?

    http://forums.devshed.com/t86331/s.html

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

IMN logo majestic logo threadwatch logo seochat tools logo