![]() |
| | #16 |
| Registered User Join Date: Jul 2009
Posts: 15
| |
| murjax is offline | |
| | #17 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| That's may well be because you're telling it to print the address of the variable. Make it print the value of the variable instead (like *EmployNum1, etc.). |
| tabstop is offline | |
| | #18 |
| Registered User Join Date: Jul 2009
Posts: 15
| That makes sense, except now I have the same problem I had before, printing the first 3 numbers correctly and then printing addresses for everything else. |
| murjax is offline | |
| | #19 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Is the return value of fscanf correct?
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is online now | |
| | #20 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Did I see code and/or an input file before? And what was the return value from fscanf? And are you printing inside or outside the while loop? And does your format actually match the text file you're reading? (For instance, if any of the pay rates are more than 10.00, or there's a space between the pay rate and the exempt character, then the answer is "no".) |
| tabstop is offline | |
| | #21 |
| Registered User Join Date: Jul 2009
Posts: 15
| |
| murjax is offline | |
| | #22 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
Code: int retv;
retv=fscanf(....);
printf("fscanf scanned %d items", retv);
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is online now | |
| | #23 | |
| Registered User Join Date: Jul 2009
Posts: 15
| Quote:
0101 41 8.11 Y 49 0722 32 7.22 N 40 1273 23 5.43 Y 39 2584 14 6.74 N 45 | |
| murjax is offline | |
| | #24 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Then don't lie to scanf -- your format must match the data, or else the attempt to read the formatted data will fail. Your format promises that there are no spaces (you get the numbers okay since %d and %f will skip spaces automatically -- but %c won't, and thus you are doomed to failure from then on). Put spaces in your format where spaces appear in your data. |
| tabstop is offline | |
| | #25 | |
| Registered User Join Date: Jul 2009
Posts: 15
| Quote:
| |
| murjax is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I have some questions :( | geekrockergal | C Programming | 19 | 02-01-2009 09:44 AM |
| whats wrong with this? | petedee | C Programming | 32 | 01-06-2004 10:28 PM |
| error in program???? | SpEkTrE | C Programming | 5 | 11-24-2003 06:16 PM |
| Contest Results - May 27, 2002 | ygfperson | A Brief History of Cprogramming.com | 18 | 06-18-2002 01:27 PM |
| Warnings, warnings, warnings? | spentdome | C Programming | 25 | 05-27-2002 06:49 PM |