freopen("xxx.in","r",stdin); freopen("xxx.out","w",stdout); ... fclose(stdin); fclose(stdout);
是这个样没错吧?