odd warning

Discussion in 'Mac Programming' started by farmerdoug, Jan 20, 2013.

  1. farmerdoug, Jan 20, 2013
    Last edited by a moderator: Jan 20, 2013

    farmerdoug macrumors 6502a

    Sep 16, 2008
    int i, *tension;
    tension = (int *) calloc(MAX_READINGS, sizeof(int));
    if (fscanf(readings,"%s %d\n", reading_times[0], tension[0]) == EOF)
  2. ArtOfWarfare macrumors G3


    Nov 26, 2007
    You didn't tell us what warning you're getting and we don't know anything about your reading_times[] variable.
  3. chown33 macrumors 604

    Aug 9, 2009
    fscanf() requires pointer-to-int for %d. What type is tension[0]?
  4. farmerdoug thread starter macrumors 6502a

    Sep 16, 2008
    thanks guys.
    I found the error while writing the post but couldn't find out how to delete it. I left out the & in front of tension[0].
  5. subsonix macrumors 68040

    Feb 2, 2008
    You probably do not want to test against EOF in *scanf functions, they return EOF only under very special circumstances. If you test against != 2, you will catch read errors and all other cases.
  6. chown33 macrumors 604

    Aug 9, 2009
    MacRumors FAQ: How do I edit or delete my post?

    To avoid having people answer or ask follow-up questions in the interval before the post is deleted, simply replace your entire post with the word "delete".

Share This Page