How does <iostream> work? (C ++)

Just out of curiosity, how iostream accesses an I / O system. (I have a bad habit of constantly reinventing the wheel, and I wonder if I can create a custom I / O system for the likes of iostream).

+3
source share
4 answers

For a detailed guide to IO streams, see Standard IOStreams and C ++ Locales . After reading, I suspect that it will be convenient for you to manage with the status quo - IOStreams is probably the most difficult part of the C ++ standard library.

+9
source

It depends...

- - . C, . .

, , . Windows, API Win32 . Linux, POSIX/C, ( , C).

+3

, , .

. , . . . ( , )

+1

streambuf. streambuf . fstreambuf; cout streambuf. , cout streambuf , , .

A common template is "filtering streambuf", which is the streambuf interface that converts its input before sending it to another streambuf. This can be combined with cout: take out the original streambuf, wrap it in a filtering streambuf, and put this wrapper back in cout. You do not need to know how the original streambuf works.

+1
source

Source: https://habr.com/ru/post/1708850/


All Articles