hey guys i've got a conversion here but it is not displaying correctly.
it is making the large hexadecimal numbers into negative decimal numbers.
also when displaying a hex number with a 0 at the front it isn't leaving displaying the 0, i need it to.
(its reading these numbers from a file.
this is the code.
thanks guys..
Code:#include <stdio.h> #include <stdlib.h> #include <math.h> FILE * inputdata; void openfile(void); int main() { openfile(); return (0); } void openfile(void) { unsigned int hex; int i=0; inputdata = fopen("numbers.txt","r"); if (inputdata==NULL) { printf("File cannot be opened for reading"); } printf("Line # Hex Decimal Binary\n"); while (fscanf(inputdata,"%x",&hex) != EOF) { printf("%i %x %d\n",i , hex , hex); i++; } }



LinkBack URL
About LinkBacks



