Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
Code:
int i, *tension;
tension = (int *) calloc(MAX_READINGS, sizeof(int));
if (fscanf(readings,"%s %d\n", reading_times[0], tension[0]) == EOF)
 
Last edited by a moderator:

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
You didn't tell us what warning you're getting and we don't know anything about your reading_times[] variable.
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
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].
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.