Mail Archives: djgpp/2000/01/23/17:17:44
David Cleaver <davidis AT ou DOT edu> wrote:
> Well, if you really want to know the print line I'm using is:
It is not a case of wanting to know. Damian needed more information
because he wanted to help you.
> Anyway, does the compiler actually think that 0xf is the same as 0x0f?
Yes, 0xf *is* the same as 0x0f (and so are 0x0000000F and 15 and 017).
> Ok, If I have four char's {0x0f, 0x0f, 0x01, 0x07}
> and I want to convert it to an int I just combine them all into:
> {0x0f0f0107} right?
> Please tell me if this is correct.
Yes and No. It is correct for what you want to do, but there are some
situations where the byte order is important.
> So, would the compiler be able to recognize if I chaged the array:
> from {0xf, 0xf, 0x1, 0x7} to {0xff17}?
>
> I don't think so. So, I would like for printf (or fprintf) to print out
> the leading zero so I don't have to go back and add all of them. Any
> help that you can give will be appreciated very much.
How about printing the whole 32-bit value with something like this:
fprintf(out, "0x%02x%02x%02x%02x",
array0[looper1][looper2],
array0[looper1][looper2+1],
array0[looper1][looper2+2],
array0[looper1][looper2+3]);
C language questions like this (and some others you've asked) would be
better put in groups such as alt.comp.lang.learn.c-c++ and comp.lang.c
- Raw text -