未验证 提交 e877460a 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #1836 from RT-Thread/fix_fputc

[libc] Fix the fputc issue when use microlib.
...@@ -313,17 +313,18 @@ int system(const char *string) ...@@ -313,17 +313,18 @@ int system(const char *string)
int fputc(int c, FILE *f) int fputc(int c, FILE *f)
{ {
char ch = c; char ch[2] = {0};
rt_kprintf(&ch); ch[1] = c;
rt_kprintf(&ch[0]);
return 1; return 1;
} }
int fgetc(FILE *f) int fgetc(FILE *f)
{ {
#ifdef RT_USING_POSIX
char ch; char ch;
#ifdef RT_USING_POSIX
if (libc_stdio_read(&ch, 1) == 1) if (libc_stdio_read(&ch, 1) == 1)
return ch; return ch;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册