Top "Printf" questions

`printf` is a common function for formatted output.

How to print a string in C++

I tried this, but it didn't work. #include <string> string someString("This is a string."); printf("%s\n", …

c++ string printf
Printing leading 0's in C?

I'm trying to find a good way to print leading 0's, such as 01001 for a zipcode. While the number would …

c printf
Why does printf not flush after the call unless a newline is in the format string?

Why does printf not flush after the call unless a newline is in the format string? Is this POSIX behavior? …

c printf flush
printf with std::string?

My understanding is that string is a member of the std namespace, so why does the following occur? #include <…

c++ string namespaces printf std
'printf' vs. 'cout' in C++

What is the difference between printf() and cout in C++?

c++ printf iostream cout stdio
Printing hexadecimal characters in C

I'm trying to read in a line of characters, then print out the hexadecimal equivalent of the characters. For example, …

c hex printf
How do you allow spaces to be entered using scanf?

Using the following code: char *name = malloc(sizeof(char) + 256); printf("What is your name? "); scanf("%s", name); printf("Hello %s. …

c string printf scanf whitespace
How can one print a size_t variable portably using the printf family?

I have a variable of type size_t, and I want to print it using printf(). What format specifier do …

c printf
How to escape the % (percent) sign in C's printf?

How do you escape the % sign when using printf in C? printf("hello\%"); /* not like this */

c printf format-string
How to print binary number via printf

Possible Duplicate: Is there a printf converter to print in binary format? Here is my program #include<stdio.h&…

c binary printf