Understanding the hardware of printf

后端 未结 5 512
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 05:42

I was wondering if there was any resources available online that explains what happens with something, like printf of C, that explains what\'s going on in the very low level

5条回答
  •  失恋的感觉
    2020-12-05 06:16

    Something like printf, or printf specifically? That is somewhat vague.

    printf outputs to the stdout FILE* stream; what that is associated with is system dependent and can moreover be redirected to any other stream device for which the OS provides a suitable device driver. I work in embedded systems, and most often stdout is by default directed to a UART for serial I/O - often that is the only stream I/O device supported, and cannot be redirected. In a GUI OS for console mode applications, the output is 'drawn' graphically in the system defined terminal font to a window, in Windows for example this may involve GDI or DirectDraw calls, which in turn access the video hardware's device driver. On a modern desktop OS, console character output does not involve the BIOS at all other than perhaps initial bootstrapping.

    So in short, there typically is a huge amount of software between a printf() call and the hardware upon which it is output.

提交回复
热议问题