29/06/10

Debugging with NSLog: format specifiers

Filed under: iPhone Dev SDK by Tesh @ 15:33

NSLog is a Foundation kit function for printing debug statements to the console. It’s very helpful to debug your applications, but sometimes you need to print some special kind of data. These are its format specifiers:

%@ Object
%d, %i signed int
%u unsigned int
%f float/double
%x, %X hexadecimal int
%o octal int
%zu size_t
%p pointer
%e float/double (in scientific notation)
%g float/double (as %f or %e, depending on value)
%s C string (bytes)
%S C string (unichar)
%.*s Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second)
%c character
%C unichar
%lld long long
%llu unsigned long long
%Lf long double



No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.