Merge pull request #1836 from RT-Thread/fix_fputc

[libc] Fix the fputc issue when use microlib.
This commit is contained in:
Bernard Xiong 2018-09-23 18:21:16 +08:00 committed by GitHub
commit e877460a53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -313,17 +313,18 @@ int system(const char *string)
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;
}
int fgetc(FILE *f)
{
#ifdef RT_USING_POSIX
char ch;
#ifdef RT_USING_POSIX
if (libc_stdio_read(&ch, 1) == 1)
return ch;
#endif