Top "Printf" questions

`printf` is a common function for formatted output.

C++ equivalent of sprintf?

I know that std::cout is the C++ equivalent of printf. What is the C++ equivalent of sprintf?

c++ printf
Is it possible to print out only a certain section of a C-string, without making a separate substring?

Say I have the following: char* string = "Hello, how are you?"; Is it possible to print out only the last 5 …

c printf c-strings
Printing a void* variable in C

Hi all I want to do a debug with printf. But I don't know how to print the "out" variable. …

c printf void-pointers uint
printf string, variable length item

#define SIZE 9 int number=5; char letters[SIZE]; /* this wont be null-terminated */ ... char fmt_string[20]; sprintf(fmt_string, "%%d %%%ds", SIZE); /* …

c format printf
PHP sprintf escaping %

I want the following output:- About to deduct 50% of € 27.59 from your Top-Up account. when I do something like this:…

php escaping printf
How to sprintf an unsigned char?

This doesn't work: unsigned char foo; foo = 0x123; sprintf("the unsigned value is:%c",foo); I get this error: cannot …

c++ printf unsigned-char
why does %d stand for Integer?

I know this doesn't sound productive, but I'm looking for a way to remember all of the formatting codes for …

c formatting printf
How to print 1 byte with printf?

I know that when using %x with printf() we are printing 4 bytes (an int in hexadecimal) from the stack. But …

c printf format-specifiers
Why use sprintf function in PHP?

I am trying to learn more about the PHP function sprintf() but php.net did not help me much as …

php printf
Clean code to printf size_t in C++ (or: Nearest equivalent of C99's %z in C++)

I have some C++ code that prints a size_t: size_t a; printf("%lu", a); I'd like this to …

c++ printf size-t