#include typedef int (*func_ptr)(const int c); extern short esp_printf( const func_ptr, const char* ctrl, ...); /*---------------------------------------------------*/ void main() { int hex_value = 0x1234; int dec_value = 1234; int neg_value = -1234; long ldec_value = 12345678L; long lneg_value = -12345678L; /* Test various cases */ esp_printf( putchar, "This first line outputs the " "format string.\r\n"); esp_printf( putchar, "%s\r\n", "This second line outputs a string."); esp_printf( putchar, "Notice that the first %s\r\n", "two output lines had " "CR/LF at the end."); esp_printf( putchar, "%c%c%c%c line outputs 'This' " "as chars.\r\n\n", 'T', 'h', 'i', 's'); esp_printf( putchar, "Dec values: %d %d " "Hex value: %x\r\n", dec_value, neg_value, hex_value); esp_printf( putchar, "Long dec values: %ld %ld\r\n", ldec_value, lneg_value); esp_printf( putchar, "Output sized strings: " "%20s %-20s\r\n", "Right string", "Left string"); esp_printf( putchar, "Output sized values: " "%20d %-20d\r\n", dec_value, neg_value); esp_printf( putchar, " " "%20x %-20x\r\n", hex_value, hex_value); esp_printf( putchar, " " "%20ld %-20ld\r\n", ldec_value, ldec_value); }