Printing variables

Sep 5, 2008 at 11:45pm
I want to print these out but I don't know what to use. I know %s = string, %c = char, %d = dword, %i = integer, etc. But I don't know all of them, could I possibly get the code to print the following two sets of variables or could I get a full list of variable = %letter?

1
2
3
CHAR Message[2048] = {0};
(unsigned char const *,int,unsigned char const *,int,bool);
sprintf(Message,"Data: %x || %i || %x || %x || %x",One,Two,Three,Four,Five);


1
2
3
CHAR Message[2048] = {0};
(PVOID,DWORD,PCHAR,DWORD,BOOL);
sprintf(Message,"Data: %x || %i || %x || %x || %x",One,Two,Three,Four,Five);


I know those %letters aren't right, but can you tell me exactly what I'll need for BOTH of these, that's what I need. And if possible, a full list of variable=%letter. The 2nd part isn't necessary but I really need both of these fixed up, thanks. By the way I have the One, Two, etc., declared as the above variables I just didn't write up the whole code.
Sep 6, 2008 at 12:05am
Sep 6, 2008 at 10:22pm
So for unsigned char const *, PCHAR and BOOL I would do %c?
What about PVOID?
Sep 7, 2008 at 1:04am
char * and related (including PCHAR) are most likely C strings, so you should use %s.
PVOID is, of course, a generic pointer. You can print the address with "0x%08x", but you'll have to cast the pointer to something if you want to do anything with the data it points to.
Topic archived. No new replies allowed.