Quantcast
Channel: User CPlus - Programming Language Design and Implementation Stack Exchange
Viewing all articles
Browse latest Browse all 66

Why does the C library include fgetpos()/fsetpos() if the same functionality can be achieved with ftell()/fseek()?

$
0
0

C includes 2 methods for saving the position of a stream and setting it later. Using fseek() and ftell():

long pos = ftell(file);// ...fseek(file, pos, SEEK_SET);

Or fgetpos() and fsetpos():

fpos_t pos;fgetpos(file, &pos);//fsetpos(file, &pos);

What is the reason for defining them both, instead of just the former?


Viewing all articles
Browse latest Browse all 66

Trending Articles



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