In C, fopen()
uses string literals such as "r"
or "r+"
or "w"
to specify the mode with which to open a file. One possible reason for this I read is at the time C was so new that there might not have been a convenient way to create predefined constants.
However, the function fseek()
which is part of the same file IO library uses predefined constants SEEK_SET
SEEK_CUR
and SEEK_END
to specify the mode.
What was the motivation for using, at least what I consider a substandard approach for flag parameters for fopen()
but not fseek()
? If fseek()
could use predefined constants as flags, why could fopen()
not?