printf

C : sprintf inside printf as first argument

Learning C at University. This is not a homework, but I was trying to do something (some "creative" part of the assignment) and got stuck. I understand that this is possible printf("%d\n", printf("23.4")); // -> 23.44 (i.e. 23.4 + 4 bytes written) but how can I use sprintf() as first argument of printf() ? something like : char * g...

C++ scanf/printf of array

I've written following code: int main() { double A[2]; printf("Enter coordinates of the point (x,y):\n"); scanf("%d,%d", &A[0], &A[1]); printf("Coordinates of the point: %d, %d", A[0], A[1]); return 0; } It's acting like this: Enter coordinates of the point (x,y): 3,5 Coordinates of the point: 3, 267...

Is there any alternative for printf ?

I have to create a software that must work on several *nix platforms (Linux, AIX, ...). I need to handle internationalization and my translation strings are in the following form: "Hi %1, you are %2." // English "Vous êtes %2, bonjour %1 !" // French Here %1 stand for the name, and %2 for another word. I may change the format, that's...

STM32 printf problem

* UPDATE * here is what I found. Whenever I had that function in there it wouldnt actually make the code lock up. what it would actually do is make the Read RTC I2C function very slow to execute but the code would still run properly, but I had to wait a really long time to get past everytime I read the RTC. so what ended up happening wa...

c printf signed float

What is the formatter to make sure that + or - signs are always shown in front of the float value in printf() in C? I haven't done C in a while, so where can I find a good reference on the web, any suggestions are appreciated ...

printf too smart casting from char to int?

Why does the following call: printf("%d %d", 'a', 'b'); result in the "correct" 97 98 values? %d indicates the function has to read 4 bytes of data, and printf shouldn't be able to tell the type of the received arguments (besides the format string), so why isn't the printed number |a||b||junk||junk|? Thanks in advance. ...

size limit of printf conversion specification

printf conversion specifications are % followed by flags, width, precision, length modifier and conversion specifier. Is there practical limit to size of a conversion specification? I.e. %s is 2 chars long, while %08.2f is 6 chars long. My question is, what is the length of the maximal single specification in a format string that can be...

STRLEN printf on two lines?

Hi, Can someone explain the following occurrence to me? unsigned int i; i = strlen("testData"); printf("%d\n", i); Output: 8 5 Why is it printing the extra 5? [Update:] After reading the comment, I stupidly realized where the 5 was coming from, sorry! ...

What does an 'F' in the Format specifier of printf mean ?

What does %.8Ff format specifier in printf do?What does F mean? ...

wprintf format type specification %ws

I just discovered that %ws was common knowledge (to some), for formatting unicode strings, as is %wZ - however msdn does not document these in a place I can find them. There are many people who write about these usefull printf format types individually on the web, but no official catch-all that I can find, and hence learn that they exist...

printf as argument of function

Usually usage of function: my_func("test"); Whether I can use this parameter so? my_func(printf("current_count_%d",ad_id)); int my_func(const char *key) ...

How to print an unsigned long int with printf in C?

Possible Duplicate: How to printf unsigned long in C? I have my number like so... int unsigned long number = 600851475143; I am trying to print it with printf(). Every time I try, I get a warning by the compiler. I've tried %uld, %ld and Googling hasn't seemed to find me the answer. I'm learning C, but have not had to us...

Populating multiple printf format placeholders with same value

Using .NET string formatting you can plug the same value into a format string multiple times: Console.Write("{0}{0}{0}", 1) //prints "111" Is there any way to do this with printf-style formatting, supplying the value only once? ...