For school I need to make this program that reeds in a file... and processes it
<B>everything works fine..</B>
except for one detail where I get strange #s (looks like address locations instead of regular numbers)
(sorry for the page width the code has made)Code:int currentLine=0; while ( fscanf( reader, "%s %s %s %d %d %d %d %d", &item[currentLine].code, &item[currentLine].name, &item[currentLine].category, &item[currentLine].location[0], &item[currentLine].location[1], &item[currentLine].location[2], &item[currentLine].location[3], &item[currentLine].location[4]) != EOF ){ printf( " %s \t%s \t\t%s \t%d \t%d \t%d \t%d \t%d\n", &item[currentLine].code, &item[currentLine].name, &item[currentLine].category, &item[currentLine].location[0], &item[currentLine].location[1], &item[currentLine].location[2], &item[currentLine].location[3], &item[currentLine].location[4]); currentLine++; }
see where I have &item[currentLine].location[3] on read line,
and then I print using the same statement and I get 4 digit numbers instead of what I am reading in!
I attached the C++ file and source I am reading, could you compile and run (it's all comple fine and ready (no erroros)) to see if you get the same result, or what could be the problem? My OS? My Turbo C++?
C SOURCE FILE: http://www.dslreports.com/r0/downloa...356/Dev1a2.zip
READ FILE: http://www.dslreports.com/r0/downloa...94/invorig.zip
I am sorry for .zip format but each .zip has only one file...
Just place both into same directory and run...
]ld you please help me fix this!
Where could I post such request on what boards?
Thank you all...


Reply With Quote
Bookmarks