I try to making a wrapping function around fscanf but didn’t understand why it didn’t work,
char name[255] = {0};
fscanf(inFile, "%s", &name); // This work fine
but when I do this
int WrapFScanF(File* inFile, const char* format, ...) {
int rv;
va_list args;
va_start(args, fmt);
rv = fscanf(file, fmt, args);
va_end(args);
return rv;
}
char name[255] = {0};
WrapFScanF(inFile, "%s", &name); // This work fine
It didn’t work. Any ideas? Thanks!
You really want to read about
vfscanf(). Use it instead offscanf()when you have ava_listasva_listcannot be used like that.