Yet another case of the question asked (can I check if a file exists using fopen()?) being completely unrelated to the actual problem (I think the code works but why doesn't it compile?).
So I'll address the actual problem in the code, not the question asked.
You probably have more brackets in the working version. Assignment is lower precedence than a comparison, so your code is actually equivalent to
Code:
if (FILE_1 = [color="RED"](fopennameoffile, "r") == NULL)){
FILE_1= fopen(nameoffile, "w");
}
The if() statement will only compile without error/warning if FILE_1 is an integral type. The body of the if() block will only compile without warniong if FILE_1 is of type FILE * (or a void pointer). Those two conditions for your code to compile are mutually exclusive.
You presumably intended something like
Code:
if ((FILE_1 = fopennameoffile, "r")) == NULL){
FILE_1= fopen(nameoffile, "w");
}
Notice how the brackets I have highlighted in red are in different places.