Quantcast
Viewing latest article 20
Browse Latest Browse All 65

What prevented fopen() from utilizing macros/flags but not fseek()?

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_SETSEEK_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?


Viewing latest article 20
Browse Latest Browse All 65

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>