diff options
| author | Bernard Xiong <[email protected]> | 2018-09-23 14:43:21 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2018-09-23 14:43:21 +0800 |
| commit | b49859582a285e4d624521e483d7718e341d652a (patch) | |
| tree | e4e5534bd6dde764a45611a2dcd6003acc538015 /components/libc | |
| parent | 4ffc675fcbf7c30b58d636a8ec92f1e6fd0054c0 (diff) | |
[libc] Fix the fputc issue when use microlib.
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/armlibc/stubs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index c826c8a0ec..83306a258d 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -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 |
