深入了解事情变得印在屏幕(COUT,printf的),以及非常复杂的东西起源,我似乎无法找到关于教科书 [英] Insight into how things get printed onto the screen (cout,printf) and origin of really complex stuff that I cant seem to find on textbooks

查看:111
本文介绍了深入了解事情变得印在屏幕(COUT,printf的),以及非常复杂的东西起源,我似乎无法找到关于教科书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想知道这一点,仍然没有找到答案。每当我们使用COUT或printf上究竟如何,就是印在屏幕上?如何文本出来,因为它确实...(这里可能是一个相当模糊的问题,不管你给我生病的工作。)。所以基本上如何这些功能做?..它是组装?如果是这样,这是否开始?这带来了更多的像如何在地球上有他们做的OpenGL / DirectX的功能问题。

I've always wondered this, and still haven't found the answer. Whenever we use "cout" or "printf" how exactly is that printed on the screen?. How does the text come out as it does...(probably quite a vague question here, ill work with whatever you give me.). So basically how are those functions made?..is it assembly?, if so where does that begin?. This brings on more questions like how on earth have they made openGl/directx functions..

打破它的人打破它。)

推荐答案

下面是一个情景,用缩写:

Here's one scenario, with abbreviations:


  1. 的printf COUT 把字符转换成在用户程序的地址空间的缓冲区。

  2. 最终缓冲区已满,或者的printf 请求缓冲区早早被清空。无论哪种方式,I / O库调用操作系统,该复制缓存的内容到它自己的空间。

  3. 假设输出文件被绑定到一个终端,操作系统提供了字符到终端的应用程序。

  4. 终端应用程序决定在缓冲区中的每个字符,它需要在屏幕上绘制像素。

  5. 终端应用程序设置像素画的说明,以及它要求一个窗口管理器做这代表它。 (在Unix上,这些天,这通常是一个X服务器。)

  6. 窗口管理器需要的像素。如果窗口在屏幕上实际可见,窗口管理器然后更新缓冲器(称​​为<青霉>帧缓冲器的),其保持可见的像素。然后窗口管理器可通知操作系统,或更可能的是,窗口管理器是在与操作系统串通并且它们共享相同的存储器。

  7. 下一次刷新屏幕时,硬件看到在帧缓冲器中的新比特,并且它以不同绘制在屏幕上。

  8. Voil&agrave ;!您可以在屏幕上的字符。

  1. printf or cout put characters into a buffer in the user program's address space.
  2. Eventually the buffer fills, or perhaps printf asks for the buffer to be emptied early. Either way, the I/O library calls the operating system, which copies the contents of the buffer to its own space.
  3. Supposing that the output file is bound to a terminal, the operating system delivers the characters to the terminal application.
  4. The terminal app decides that for each character in the buffer, it needs to paint pixels on the screen.
  5. The terminal app sets up pixel-painting instructions, and it asks a window manager to do this on its behalf. (On Unix these days this is usually an X server.)
  6. The window manager takes the pixels. If the window is actually visible on the screen, the window manager then updates a buffer (called the frame buffer) which holds the visible pixels. The window manager may then notify the operating system, or more likely, the window manager is in cahoots with the operating system and they are sharing the same memory.
  7. The next time the screen is refreshed, the hardware sees the new bits in the frame buffer, and it paints the screen differently.
  8. Voilà! You have characters on the screen.

这是惊人的,熊跳舞的。

It is amazing that the bear dances at all.

这篇关于深入了解事情变得印在屏幕(COUT,printf的),以及非常复杂的东西起源,我似乎无法找到关于教科书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆