As in C ++, you can display information on the screen (or in a file) without using any link libraries, i.e. without iostream, stdio, etc. How do printf (), scanf () and cout, cin objects work, and how can you implement them yourself?

  • Why all the same? - nick_n_a
  • Windows has a table KeServices, through Int2E, if I’m not mistaken, you can get access to basic functions. Linux itself is conveniently through syscall which is also available via int. - nick_n_a
  • If revision is interesting, you can see musl , another version of libc (the main library linking C / C ++ with the OS kernel) for Linux (although most of the functions are system independent). - avp

2 answers 2

I / O is provided in the language only in the form of the functionality of the standard library. If you don’t use it, you’ll have to get by with additional platform-specific tools provided by the operating system. For example, for Windows, this is WinAPI, that is, functions like CreateFile , available only under this platform.

In this case, your program, of course, loses its cross-platform.


Since the implementation of library functions is built under the hood on a system-dependent API, it is clear that in this way you can build your own similar bike.

    Through the calls of the operating system.

    You work under DOS :) - use DOS / BIOS interrupts or direct output to video memory, under Windows — for example, WriteFile to standard output, or the Console family ... Under Linux — its API.