Q:

#define usage in C/C++

I need to write such a define in C/C++
#define scanf( fscanf(inf,

in order to replace each scanf( with fscanf(inf, literary 
But I do not know how...
Thanks

A:

You want to use a Variadic macro.
In your case, I believe you want:
#define scanf(...) fscanf(inf,__VA_ARGS__)

A:

I need to write such a define in C++

No, you don't. What you really want to do is redirect stdin.
freopen(inf, "r", stdin);

A:

Just write all your code using fscanf, and define the file name with a macro like this:
#ifdef USE_SCANF
#define SCANF_FILE(file) stdin
#else
#define SCANF_FILE(file) file
#endif

fscanf(SCANF_FILE(blah), "%d", &a);

