Hello I made an easy program which should copy a program ex.txt (containing 531) in a nex file, but when i launch it, it returns segmentation fault.
Can you tell me what is wrong with my program ?
thanks
Code:# include <stdio.h> int main (void){ int a; FILE *f1, *f2; f1 = fopen("~/Document/INF123/TEST/ex.txt", "r"); f2 = fopen("~/Document/INF123/TEST/pr.txt", "w"); fscanf(f1, "%d", &a); fprintf(f2, "%d", a); close(f1); close(f2); return 0; }