Format specifier for pointers?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Freaks,

 

I cannot recall the format specifier for use

with GNU Cs sprintf() for pointers to RAM.

 

Appreciate the help.

 

A.

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.nongnu.org/avr-libc/u...

 

Lower case p ?

p=> p The void * argument is taken as an unsigned integer, and converted similarly as a %#x command would do.

"'p' is for pointer" ? ;)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you,

 

A.

AVR Studio 4 Ver. 4.18 684
avr-gcc Ver. 4.3.0
ISIS 7
ELECTRA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

These days I no longer bother to keep a copy of the C library documentation to hand (I always used to use the excellent reference that came with Borland 3 in fact) because I find all the answers I need about C and C++ at:

 

http://www.cplusplus.com/

 

In this case the documentation for <stdio.h> (aka <cstdio>) is here:

 

http://www.cplusplus.com/referen...

 

and for printf() in particular here:

 

http://www.cplusplus.com/referen...

 

But do people actually use %p and especially on an AVR. On an AVR a pointer is a 16bit unsigned number. I'd generally just use %04X or something myself.

 

(OK just realised this forum might mean 32bit ARM or UC3 where I guess the pointers are 32 bit? Even so %08X in that case)