user11680003
user11680003

Reputation:

How stream buffer is implemented in C?

I'm new to C, sorry if my question is dumb.

Where is the source code for IO stream? I want to see how the stream buffer is implemented, I can only see _IO_FILE struct in libc.h, but I don't see any internal buffer in this struct. Can anyone show me how can I locate the implmentation of stream buffer?

Upvotes: 3

Views: 305

Answers (2)

Brett Hale
Brett Hale

Reputation: 22318

The musl C library is very clean and well-designed.

The implementation is in the stdio directory, and the stdio internal function prototypes and macros are found in: stdio_impl.h

Upvotes: 0

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136237

Where is the source code for IO stream?

For glibc the code is in libio directory.

In particular, _IO_new_file_fopen function implements fopen.

Upvotes: 2

Related Questions