2022-08-02 13:30:05 +00:00
|
|
|
#include <limits.h>
|
2021-04-27 16:33:31 +00:00
|
|
|
#include <stdio.h>
|
2021-05-09 22:12:43 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
2021-04-27 16:33:31 +00:00
|
|
|
|
2022-08-02 13:30:05 +00:00
|
|
|
int vfscanf(FILE* stream, const char* format, va_list arg)
|
2021-04-27 16:33:31 +00:00
|
|
|
{
|
2022-08-02 13:30:05 +00:00
|
|
|
static char scanf_buffer[STDIO_MAX_MEM];
|
|
|
|
fgets(scanf_buffer, STDIO_MAX_MEM-1, stream);
|
|
|
|
return vsscanf(scanf_buffer, format, arg);
|
2021-05-09 22:12:43 +00:00
|
|
|
}
|
|
|
|
|
2022-08-02 13:30:05 +00:00
|
|
|
int fscanf(FILE* stream, const char* format, ...)
|
2021-05-09 22:12:43 +00:00
|
|
|
{
|
2022-08-02 13:30:05 +00:00
|
|
|
va_list arg;
|
|
|
|
int n;
|
|
|
|
va_start(arg, format);
|
2021-05-09 22:12:43 +00:00
|
|
|
|
2022-08-02 13:30:05 +00:00
|
|
|
n = vfscanf(stream, format, arg);
|
2021-05-09 22:12:43 +00:00
|
|
|
|
2022-08-02 13:30:05 +00:00
|
|
|
va_end(arg);
|
|
|
|
return n;
|
2021-04-27 16:33:31 +00:00
|
|
|
}
|