Yeah, that works...
Now, remember the fopen returns a FILE*. You need to save this, because this is the stream to the file that you must pass to fgets to read from the file later.
So usually, you save that FILE* from fopen and check it for NULL. If it's NULL, you usually print an error and abort. Otherwise, you proceed.