thank you for helping
thank you for helping
Last edited by deathrattle; 12-02-2008 at 07:57 PM.
That's because you're not reading them properly . Do a bit of error checking in your fscanf() and you'll probably find out it's not reading everything you want.
For example (just match the colours up to see what's read):
The underlined part isn't read (By this call anyway), thus those numbers remain uninitialized (or random as you call them).Code:fscanf(fPIn, "%s%s%d%d%s%d%d", ...); Peter Griffin 1 111-11-1111 May 9, 1965
Also, you have a buffer overflow (well a potential one), for example what if someone has name bigger than char fName[MAX];? Perhaps use fgets() and sscanf()
Last edited by zacs7; 12-02-2008 at 06:21 PM.
Look at this:
and this:Code:fscanf(fPIn, "%s%s%d%d%s%d%d"
and note that a ',' is not a whitespace.Code:Peter Griffin 1 111-11-1111 May 9, 1965
Possible solutions is not putting the , in the file or doing something like:
which migh work (never seriously using scanf). But the generally that way you skip specific characters.Code:fscanf(fPIn, "%s%s%d%d%s%d,%d"
edit: or probably you need beCode:fscanf(fPIn, "%s %s %d %d-%d-%d %s %d, %d"
Clicky
Simply use this in conjunction with your current code to print dates in a readable format.