mickit 发表于 2024-9-20 20:00

使用printf



#if defined (__CC_ARM)          //KEIL
#pragma import(__use_no_semihosting) //取消ARM的半主机工作模式
void _sys_exit(int x) //定义_sys_exit()以避免使用半主机模式
{
    x = x;
}
struct __FILE //标准库需要的支持函数
{
    int handle;
    /* Whatever you require here. If the only file you are using is */
    /* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef?d in stdio.h. */
FILE __stdout;

#endif


yangxiaor520 发表于 2024-9-21 09:12

printf函数实现一是重定义putc函数,二是自己通过钓鱼C语言的格式化字符串函数来实现

shenxiaolin 发表于 2024-9-29 10:41

需要重定向

更多更合适ii 发表于 2024-9-30 17:26

struct __FILE //标准库需要的支持函数
页: [1]
查看完整版本: 使用printf