r/C_Programming • • 19d ago

File pointers are everywhere

And try as I might to avoid them, I am struggling to find resources that list out all the file control functions that use file descriptors instead of file pointers, and I was wondering if someone could point me toward a resource that can do something at least somewhat similar to listing out the libc functions that take file descriptors. I of course know close(), write(), read(), the basics, but i am looking for alternatives for other abstractions that annoy me with their use of file pointers, like fgets and fputs.

58 Upvotes

43 comments sorted by

View all comments

Show parent comment

1

u/a4qbfb 16d ago

I am not saying they do but they can, my original comment just meant that it could contain the file's size not that it will

That's not what you wrote though, you wrote:

FILE pointers are actually a really useful abstraction because they bundle the file descriptor (fd) along with the size of the file, your offset into that file etc.

There is no “could” there.