guys that stuff looks really technical and i can't really understand it..
i'll definently spend alot of today trying to make something like you have suggested work, or possibly you could help me with this idea..
this is my current code.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
FILE * inputdata;
void readfromfile(void);
int main()
{
readfromfile();
return (0);
}
void readfromfile(void)
{
unsigned int hex;
int i=0;
inputdata = fopen("numbers.txt","r");
printf("Line # Hex Decimal Binary\n");
while (fscanf(inputdata,"%x",&hex) == 1)
{
printf("%i %8x %u\n",i , hex , hex, hex);
i++;
}
}
and i realised that with this for loop i'm able to convert the numbers into binary like i need to, but i'm not able to work it into my printf. i couldn't figure out how.
Code:
for(i = 0; i < 32; i++)
printf("%d", (value >> (31 - i)) & 1);
i tried to put it inside the printf then i decided thats probably not even possible, then i was trying to work it into storing it into a new variable, but i just really couldn't grasp the concept of what was needed to acheive this. so if anyone could explain how i could use that to convert to binary that would be great. it does work, i just can't work it properly.