Mail Archives: djgpp/2000/01/23/15:40:27
Hello,
Well, if you really want to know the print line I'm using is:
fprintf(out, "%#x", array0[looper1][looper2]);
where array0 contains unsigned char's
Anyway, does the compiler actually think that 0xf is the same as 0x0f?
I personally think it should print out the leading zero, but, maybe
thats just me. Is there a way to get it to print out that leading
zero? The reason I'm asking is, if I want to change from char's to
int's I just want to delete the "0x"'s from most of the char's. I'll
give an example below...
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.
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.
-David C.
Damian Yerrick wrote:
>
> On Sun, 23 Jan 2000 11:04:43 -0600, David Cleaver <davidis AT ou DOT edu>
> wrote:
>
> >Hello again everyone,
> >
> >First, I want everyone to know I'm using DJGPP v2.03. OK, now, recently
> >I've tried to use the printf() function to print out the hex values of
> >some unsigned char's that I have. However, I'm not sure that it always
> >did just that. Let me give you an example:
> >
> >{ 0xbc, 0xf, 0},
> >
> >This is part of the output of the program. My question is, WHAT does
> >"0xf" mean?????????
>
> If you're using char to hold keypresses:
> 0xf = binary 00001111 = ascii code for Ctrl+O
> If you're using char as an 8-bit integer:
> 0xf = decimal 15
>
> Does your line look anything like this?
> printf("character %c = 0x%x\n", c, (int)c);
>
> --
> Damian Yerrick http://yerricde.tripod.com/
> View full sig at http://www.rose-hulman.edu/~yerricde/sig.html
> Comment on story ideas at http://home1.gte.net/frodo/quickjot.html
- Raw text -