>>404
char *filename(int n) { static char buf[100]; sprintf(buf, "filename%d", n); return buf; }

fopen(filename(n), ... )