Originally Posted by
Click_here
thanks for your help...my main problem at the moment is actually trying to print the data from a .d file. This is just a sample of what i've done so far (i know error recovery methods and stuff are missing - just providing the main overview of trying to work out how to actually print the .d files data) - when executing the program i get 85 10 0 1 2 3 4 5 6 7 8 9 (the output is supposed to be just 0 1 2 3 4 5 6 7 8 9). Have i totally misunderstood the approach of opening/reading the data and printing it or just missed something ? Again, sorry if this seems obvious - a novice programmer.
Code:
#include <stdio.h>
#define BUFFSIZE 8
int main(void)
{
FILE *inBinFile;
unsigned char buff[BUFFSIZE];
int x;
inBinFile = fopen( "u.d", "rb" );
while ( ( x = fgetc( inBinFile ) ) != EOF )
{
printf( "%d\n", x );
}
return 0;
}