I am trying to run a code with freopen() on mac os, but it doesn't print any output in the specified file. although, it works perfectly on windows. I am using the X-Code Editor and the input and the output files are in the same path as the cpp file
#include <cstdio>
int main(){
freopen("input.in","r",stdin);
freopen("output.out","w",stdout);
int x;
scanf("%d",&x);
printf("%d\n",x);
return 0;
}