I created a program that open a file, reads the content and prints it. But, the 'fopen' returns 'NULL'. In the 'fopen', I tried with r, with a+, but nothing. The file written nella 'fopen' exist, so I don't why it returns NULL.
Here is the code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <time.h>
#include <errno.h>
#include <iso646.h>
#include <stddef.h>
int main() {
FILE *fp=fopen("prova.txt", "a+");
int vett[50];
int i;
if (fp!=NULL) {
    printf("Il file è stato aperto con successo!");
    
}else{
    printf("Il file non è stato aperto con successo");
    return 0;
}
for (i = 0; !feof(fp); i++) {
    fscanf(fp, "%d", &vett[i]);
    printf("\n%d\n",vett[i]);
    
}
return 0;
}
Can you help me?
 
     
    