Closed maska989 closed 1 year ago
Using fscanf with specifier %c shall move the position indicator one place further but in this case, this function tries to pass over all characters in the file.
Tested on Host-generic-pc and Ia32-generic-qemu.
To reproduce issue copy following code:
#include <stdio.h> int main(void) { char c[1]; FILE *rd; rd = fopen("test", "w+"); fputs("abc", rd); fseek(rd, 0, SEEK_SET); printf("\nposi before = %ld\n", ftell(rd)); fscanf(rd, "%c", c); printf("\nposi after = %ld\n", ftell(rd)); fclose(rd); }
@maska989 I added a fix, please verify if it works in your test cases.
@gerard5 Works like a charm.
https://github.com/phoenix-rtos/phoenix-rtos-tests/blob/c13ef424dff7c1f0f88f02e4a67104f6d9ed5d22/libc/stdio_scanf.c#L3330-L3333
Using fscanf with specifier %c shall move the position indicator one place further but in this case, this function tries to pass over all characters in the file.
Tested on Host-generic-pc and Ia32-generic-qemu.
To reproduce issue copy following code: