Global Information Lookup Global Information

Printf information


An example of the printf function

printf is a C standard library function that formats text and writes it to standard output.

The name, printf is short for print formatted where print refers to output to a printer although the functions are not limited to printer output.

The standard library provides many other similar functions that form a family of printf-like functions. These functions accept a format string parameter and a variable number of value parameters that the function serializes per the format string and writes to an output stream or a string buffer.

The format string is encoded as a template language consisting of verbatim text and format specifiers that each specify how to serialize a value. As the format string is processed left-to-right, a subsequent value is used for each format specifier found. A format specifier starts with a % character and has one or more following characters that specify how to serialize a value.

The format string syntax and semantics is the same for all of the functions in the printf-like family.

Mismatch between the format specifiers and count and type of values can cause a crash or vulnerability.

The printf format string is complementary to the scanf format string, which provides formatted input (lexing a.k.a. parsing). Both format strings provide relatively simple functionality compared to other template engines, lexers and parsers.

The formatting design has been copied in other programming languages.

and 20 Related for: Printf information

Request time (Page generated in 0.9274 seconds.)

Printf

Last Update:

printf is a C standard library function that formats text and writes it to standard output. The name, printf is short for print formatted where print refers...

Word Count : 2297

Printk

Last Update:

kernel log. It provides a printf-like abstraction and its parsing of the format string and arguments behave similarly to printf. It acts as a debugging...

Word Count : 682

Bitwise operations in C

Last Update:

0; i--) { putchar(x & (1u << i) ? '1' : '0'); } printf("\n"); } int main( void ) { int j = 5225; printf("%d in binary \t\t ", j); showbits(j); /* the loop...

Word Count : 1863

Prettyprint

Last Update:

k){if(k<1||k>2){printf("out of range\n"); printf("this function requires a value of 1 or 2\n");}else{ printf("Switching\n");switch(k){case 1:printf("1\n");break;case...

Word Count : 1291

Switch statement

Last Update:

(age) { case 1: printf("You're one."); break; case 2: printf("You're two."); break; case 3: printf("You're three."); break; case 4: printf("You're three...

Word Count : 2728

C syntax

Last Update:

appended to strings at compile time: printf(__FILE__ ": %d: Hello " "world\n", __LINE__); will expand to printf("helloworld.c" ": %d: Hello " "world\n"...

Word Count : 9787

Loop unrolling

Last Update:

(repeat--) { printf("process(%d)\n", i ); printf("process(%d)\n", i + 1); printf("process(%d)\n", i + 2); printf("process(%d)\n", i + 3); printf("process(%d)\n"...

Word Count : 3268

Uncontrolled format string

Last Update:

string parameter in certain C functions that perform formatting, such as printf(). A malicious user may use the %s and %x format tokens, among others, to...

Word Count : 1327

Debugging

Last Update:

into the source code. The latter is sometimes called printf debugging, due to the use of the printf function in C. This kind of debugging was turned on...

Word Count : 3530

X macro

Last Update:

value3; void print_variables(void) { printf("%s = %d\n", "value1", value1); printf("%s = %d\n", "value2", value2); printf("%s = %d\n", "value3", value3); }...

Word Count : 611

Syntax highlighting

Last Update:

<stdio.h> int main() { printf("Hello World\n"); return 0; } /* Hello World */ #include <stdlib.h> #include <stdio.h> int main() { printf("Hello World\n");...

Word Count : 1495

C data types

Last Update:

functionality of the types defined in the <stdint.h> header. It defines macros for printf format string and scanf format string specifiers corresponding to the types...

Word Count : 3253

X86 assembly language

Last Update:

RVA(msvcrt_printf) dd RVA(msvcrt_exit) dd 0 msvcrt_imports: printf dd RVA(msvcrt_printf) exit dd RVA(msvcrt_exit) dd 0 msvcrt_printf: dw 1 dw "printf", 0 msvcrt_exit:...

Word Count : 6902

GNU Debugger

Last Update:

strlen( s ); } int main( int argc, char *argv[] ) { const char *a = NULL; printf( "size of a = %lu\n", foo_len(a) ); exit( 0 ); } Using the GCC compiler...

Word Count : 1664

Pthreads

Last Update:

NUM_THREADS; printf("Thread %d: Started.\n", index); printf("Thread %d: Will be sleeping for %d seconds.\n", index, sleep_time); sleep(sleep_time); printf("Thread...

Word Count : 1086

Standard streams

Last Update:

Example # ALGOL 68 example # main:( REAL number; getf(stand in,($g$,number)); printf(($"Number is: "g(6,4)"OR "$,number)); # OR # putf(stand out,($" Number is:...

Word Count : 2487

Scanf

Last Update:

68. Input format strings are complementary to output format strings (see printf), which provide formatted output (templating). Mike Lesk's portable input/output...

Word Count : 1379

Getopt

Last Update:

{ printf ("digits occur in two different argv-elements.\n"); } digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option...

Word Count : 2408

Variadic template

Last Update:

as printf), but also allowing a function called with printf-like syntax to process non-trivial objects. template<typename... Params> void my_printf(const...

Word Count : 1669

Mmap

Last Update:

case 0: childpid = getpid(); printf("PID %d:\tanonymous %s, zero-backed %s\n", childpid, anon, zero); sleep(3); printf("PID %d:\tanonymous %s, zero-backed...

Word Count : 1149

PDF Search Engine © AllGlobal.net