Ignoring the fact that you have no business dereferencing a FILE*
pointer yourself, what ever gave you the idea that that structure
has a FileName field?
I said "more likely to compile"; I didn't say "a good idea"
or anything else that should be taken as indicative of approval
of the method.
It is a matter of probabilities: each compiler has a limited number
of -possible- field names for a structure member, possibly
on the order of pow(53,31) or pow(53,127) for that compiler.
If the filename is (as is the premise of this thread) stored
in the FILE structure, then there is a field name for it, and
FileName has a 1 in pow(53,31) or pow(53,127) or whatever of
being that field name and thus that using fd->FileName would
compile to do what Nigel was hoping.
If, though, fd.FileName is used instead of fd->FileName, then
beyond the 1 in pow(53,31) or pow(53,127) (or whatever) chance,
the compiler, after detecting (and issuing a diagnostic for)
the constraint violation of fd.FileName, would have to choose to
continue compilation. That is a -possibility-, but the -probability-
that the compiler would choose that is something less than 1,
so using fd.FileName instead of fd->FileName would have a lower
probability of compiling than fd->FileName would -- which was
all that I stated.