<p>本来不应回答这个问题，但由于我自己也是搞IT的，看到同行不能理解英文文档，我也很不安。所以就翻译了一下。 </p>

<p>其次，当从标准IO库获取输入时，不论是(a)以非缓冲流，还是(b)以行缓冲流（要求数据从内核中取出）形式，所有的行缓冲输出流都会被清除。(b)中需要“要求数据‌​从内核中取出”这个限定，是因为所请求的数据也许已在缓冲中，这样就不需要从内核中读取了。当然，所有来自非缓冲流的输入，即（a）情况，都需要从内核获得数据。</p>

CC BY-SA 3.0
2013-11-18T21:32:45.080Z
[Good Guy 孤影萍踪](http://imgur.com/l4Q9QYb)
Stumpy Joe Pete
CC BY-SA 3.0
2013-11-18T23:12:27.443Z
@StumpyJoePete - Nice GGG, but answering off topic questions with good answers only encourages people to ask more off topic questions.
going
CC BY-SA 3.0
2013-11-18T19:34:24.553Z
2013-11-18T19:34:24.553Z
孤影萍踪
<p>下面是英文的干活：
Second, whenever input is requested through the standard I/O library from either (a)an unbuffered stream or (b)a line-buffered stream (that requires data to be requested from the kernel),all line-buffered output streams are flushed. The reason for the qualifier on (b) is that the requested data may already be in the buffer, which doesn’t require data to be read from the kernel. Obviously, any input from an unbuffered stream, item (a), requires data to be obtained from the kernel
这段话是《Advanced Programming in the UNIX Environment 3rd Edition》的Standard I/O Library那一章的一段话，学渣表示完全不能理解。求大神帮着理解一下。 </p>

CC BY-SA 3.0
2013-11-18T16:48:23.317Z
这里是学中文的站……英语问题请移步ell.stackexchange.com，不过估计那里也不收这种问题，还是去主站stackoverflow.com找他们用简单英语解释下吧……
arax
CC BY-SA 3.0
2013-11-18T20:07:46.633Z
This question appears to be off-topic because it is about translating from English to Chinese.
deutschZuid
CC BY-SA 3.0
2013-11-18T23:14:08.310Z
Thanks for asking your question. This site is to assist people with learning Chinese. That means we require that questions (including the topic) are asked in English. Your question is also asking for a translation, we do not provide bulk translations. If you have a specific word or phrase that you are having issue with please edit your question to ask a specific question and the use the "flag" option to have it reopened.
going
CC BY-SA 3.0
2013-11-18T23:36:32.673Z
@whatout 我翻译完后，才注意到你提到的书名《Advanced Programming in the UNIX Environment》。我手头儿上正好有这本书的中文版（10多年前在国内买的）。我翻到那一段，发现译得比较生硬，还没有我翻译得好呢。英文好的话，这种技术书，要看英文原版的。中文版的，很少有翻译得准确流畅的。
孤影萍踪
CC BY-SA 3.0
2013-11-19T01:58:23.367Z
@孤影萍踪 是啊，我也看过这一段。其实你翻译的这一段我还是不能够理解。我主要是因为国内翻译太慢，等不及了。
whatout
CC BY-SA 3.0
2013-11-19T02:10:23.420Z
@孤影萍踪 其实我大概能猜到点中文含义，主要是不理解它的机制
whatout
CC BY-SA 3.0
2013-11-19T23:58:41.000Z
@whatout 我的理解是，输出是有缓冲的，即所输出的内容暂时存在内存中。若下个数据请求所要的数据仍在缓冲中，则直接从缓冲中读出，不必从内核中读取了。有两种情况下，输出缓冲中旧有的数据要被清除，因为要放入新的数据。1）以非缓冲形式请求输入（即要求直接从内核中读数据）， 2）以缓冲形式请求输入但所需数据不在缓冲中，所以只能从内核中读出。这两种情况归为，只要从内核中读数据，旧的缓冲数据都将被清除，以放入新的数据。
孤影萍踪
<translation>
unix(apue) 高级程序设计理解问题
# unix(apue) 高级程序设计理解问题

(Asked by: username_0 on 2013-11-18)

下面是英文的干活：
Second, whenever input is requested through the standard I/O library from either (a)an unbuffered stream or (b)a line-buffered stream (that requires data to be requested from the kernel),all line-buffered output streams are flushed. The reason for the qualifier on (b) is that the requested data may already be in the buffer, which doesn’t require data to be read from the kernel. Obviously, any input from an unbuffered stream, item (a), requires data to be obtained from the kernel
这段话是《Advanced Programming in the UNIX Environment 3rd Edition》的Standard I/O Library那一章的一段话，学渣表示完全不能理解。求大神帮着理解一下。

**Tags:** translation

> **Comments:**
> **username_1**: 这里是学中文的站……英语问题请移步ell.stackexchange.com，不过估计那里也不收这种问题，还是去主站stackoverflow.com找他们用简单英语解释下吧……  
> **username_2**: This question appears to be off-topic because it is about translating from English to Chinese.  
> **username_3**: Thanks for asking your question. This site is to assist people with learning Chinese. That means we require that questions (including the topic) are asked in English. Your question is also asking for a translation, we do not provide bulk translations. If you have a specific word or phrase that you are having issue with please edit your question to ask a specific question and the use the "flag" option to have it reopened.  
> **username_4**: @username_0 我翻译完后，才注意到你提到的书名《Advanced Programming in the UNIX Environment》。我手头儿上正好有这本书的中文版（10多年前在国内买的）。我翻到那一段，发现译得比较生硬，还没有我翻译得好呢。英文好的话，这种技术书，要看英文原版的。中文版的，很少有翻译得准确流畅的。  
> **username_0**: @username_4 是啊，我也看过这一段。其实你翻译的这一段我还是不能够理解。我主要是因为国内翻译太慢，等不及了。  
> **username_0**: @username_4 其实我大概能猜到点中文含义，主要是不理解它的机制  
> **username_4**: @username_0 我的理解是，输出是有缓冲的，即所输出的内容暂时存在内存中。若下个数据请求所要的数据仍在缓冲中，则直接从缓冲中读出，不必从内核中读取了。有两种情况下，输出缓冲中旧有的数据要被清除，因为要放入新的数据。1）以非缓冲形式请求输入（即要求直接从内核中读数据）， 2）以缓冲形式请求输入但所需数据不在缓冲中，所以只能从内核中读出。这两种情况归为，只要从内核中读数据，旧的缓冲数据都将被清除，以放入新的数据。  

---

## 1 answers

### Answer by username_4 on 2013-11-18. Score: 2 | Accepted answer

本来不应回答这个问题，但由于我自己也是搞IT的，看到同行不能理解英文文档，我也很不安。所以就翻译了一下。

其次，当从标准IO库获取输入时，不论是(a)以非缓冲流，还是(b)以行缓冲流（要求数据从内核中取出）形式，所有的行缓冲输出流都会被清除。(b)中需要“要求数据‌​从内核中取出”这个限定，是因为所请求的数据也许已在缓冲中，这样就不需要从内核中读取了。当然，所有来自非缓冲流的输入，即（a）情况，都需要从内核获得数据。

> **Comments:**
> **username_5**: [Good Guy username_4](http://imgur.com/l4Q9QYb)  
> **username_3**: @username_5 - Nice GGG, but answering off topic questions with good answers only encourages people to ask more off topic questions.  

---

