odd warning - MacRumors Forums
Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 20, 2013, 12:00 PM   #1
farmerdoug
macrumors 6502a
 
Join Date: Sep 2008
odd warning

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 OllyW; Jan 20, 2013 at 12:29 PM. Reason: fixed code tags
farmerdoug is offline   0 Reply With Quote
Old Jan 20, 2013, 12:17 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
You didn't tell us what warning you're getting and we don't know anything about your reading_times[] variable.
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 20, 2013, 12:31 PM   #3
chown33
macrumors 603
 
Join Date: Aug 2009
fscanf() requires pointer-to-int for %d. What type is tension[0]?
chown33 is offline   0 Reply With Quote
Old Jan 21, 2013, 05:50 AM   #4
farmerdoug
Thread Starter
macrumors 6502a
 
Join Date: Sep 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].
farmerdoug is offline   0 Reply With Quote
Old Jan 21, 2013, 11:08 AM   #5
subsonix
macrumors 68030
 
Join Date: Feb 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.
subsonix is offline   0 Reply With Quote
Old Jan 21, 2013, 11:08 AM   #6
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by farmerdoug View Post
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].
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".
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Odd issue with my new 21.5 iMac (keystrokes making an odd sound emit from speakers) Whackintosh iMac 5 Mar 12, 2013 07:40 PM
iPhone: Odd 6.0 Jailbreak hakrat51 Jailbreaks and iOS Hacks 15 Oct 2, 2012 09:43 PM
odd problem with wi fi Omnius Mac OS X 10.7 Lion 0 Aug 27, 2012 09:37 PM
Has the ODD gone ?? Tobias Funke MacBook Pro 12 Jun 11, 2012 03:47 PM

Forum Jump

All times are GMT -5. The time now is 08:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC