Rev 1735 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1735 | Rev 1780 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | #define BUFFER_SIZE 32 |
31 | #define BUFFER_SIZE 32 |
32 | 32 | ||
33 | void test(void) |
33 | void test(void) |
34 | { |
34 | { |
35 | int retval; |
35 | int retval; |
36 | __native nat = 0x12345678u; |
36 | unative_t nat = 0x12345678u; |
37 | 37 | ||
38 | char buffer[BUFFER_SIZE]; |
38 | char buffer[BUFFER_SIZE]; |
39 | 39 | ||
40 | printf(" Printf test \n"); |
40 | printf(" Printf test \n"); |
41 | 41 | ||
Line 47... | Line 47... | ||
47 | printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' ); |
47 | printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' ); |
48 | printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 ); |
48 | printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 ); |
49 | printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 ); |
49 | printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 ); |
50 | printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 ); |
50 | printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 ); |
51 | 51 | ||
52 | printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zx'. '%#llx' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" ); |
52 | printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, unative_t '%#zx'. '%#llx' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" ); |
53 | 53 | ||
54 | printf(" Print to NULL '%s'\n",NULL); |
54 | printf(" Print to NULL '%s'\n",NULL); |
55 | 55 | ||
56 | retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters."); |
56 | retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters."); |
57 | printf("Result is: '%s', retval = %d\n", buffer, retval); |
57 | printf("Result is: '%s', retval = %d\n", buffer, retval); |