format-specifiers

What does the %*s format specifier mean?

In some code that I have to maintain, I have seen a format specifier %*s . Can anybody tell me what this is and why it is used? An example of its usage is like: fprintf(outFile, "\n%*s", indent, ""); ...

what does the % % mean in java?

Im a PHP-programmer and wonder what this line means. System.out.printf("exp(%.3f) is %.3f%n", x, Math.exp(x)) what does %.3f, %.3f%n and the comma x means? ...

Platform independent size_t Format specifiers in c?

I want to print out a variable for type size_t in c but it appears that size_t is aliased to different variable types on different architextures. For example on one machine (64-bit) the following code does not throw any warmings: size_t size = 1; printf("the size is %ld", size); but on my other machine (32_bit) the above code produces...

C format specifier

While i am working ,somewhere inside the code i saw the following staements. I am getting confused by the format specifier in sprintf d_number = strtol( tmp_buf , (char **)NULL, 16); memset( tmp_buf , ' ' , sizeof( tmp_buf ) ); sprintf( tmp_buf , "%0.*d" , (int)sizeof( dec_number ) , d_number ); could anybody explain please?...

Alternate format specifiers for long long in C

Is there any other (alternative) format specifiers for long long in C other than %lld which can be safely used in scanf under gcc? I am aware that %lld does it's job fine; I am just inquisitive :-) ...

format specifier for short integer

I don't use correctly the format specifiers in C. A few lines of code: int main() { char dest[]="stack"; unsigned short val = 500; char c = 'a'; char* final = (char*) malloc(strlen(dest) + 6); snprintf(final, strlen(dest)+6, "%c%c%hd%c%c%s", c, c, val, c, c, dest); printf("%s\n", final...

copying a short int to a char array

I have a short integer variable called s_int that holds value = 2 unsighed short s_int = 2; I want to copy this number to a char array to the first and second position of a char array. Let's say we have char buffer[10];. We want the two bytes of s_int to be copied at buffer[0] and buffer[1]. How can I do it? ...

NSDate from NSString

I have a string in the format "Fri Jul 09 17:57:44 +0000 2010" which I need to convert to an NSDate. I have tried a few unsuccessful operations to convert this date, and was wondering if anyone could tell me how I can achieve this. Regards ...

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

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