Instead, the usual approach (and the one taken in C's stdio library) is that you mention the name of the file once, at the time you open it.
You use some little token--in this case, the file pointer--which keeps track (both for your sake and the library's) of which file you're talking about.