标题:请问一下clog 的问题
只看楼主
死了都要C
Rank: 4
来 自:四川成都
等 级:贵宾
威 望:13
帖 子:1582
专家分:116
注 册:2006-12-7
结帖率:66.67%
 问题点数:0 回复次数:7 
请问一下clog 的问题
书上是这样的:

          clog对象用于产生程序执行的一般信息.

          一般情况下,系统将 cin, cout, cerr, clog对象与执行程序的窗口联系起来.这样,当我们从cin读入时.大部分数据从执

行程序的窗口读入,当写到cout, cerr 或 clog 时, 输出写至同一窗口,运行程序时. 大部分操作系统都提供了重定向输入或输

出的方法.利用重定向可以将这些流与所选择的文件联系起来.


          红字看不懂```clog是怎么用的啊```那个````重定向输入或输出```又是怎么回事呢```

请大家帮帮忙```谢谢````
搜索更多相关主题的帖子: clog cerr cin cout 窗口 
2007-11-25 16:58
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
MSDN下吧

clog没用过!

Fight  to win  or  die...
2007-11-25 17:43
死了都要C
Rank: 4
来 自:四川成都
等 级:贵宾
威 望:13
帖 子:1582
专家分:116
注 册:2006-12-7
得分:0 
MSDN```应该很大吧```我是网吧学的```没有自己的电脑啊```

女施主``我给你``送茶来了```师太``你就从了老衲吧``
代码本天成~~~妙头偶得之```
2007-11-25 17:58
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
在线 MSDN 啦。

baidu,google

Fight  to win  or  die...
2007-11-25 18:05
死了都要C
Rank: 4
来 自:四川成都
等 级:贵宾
威 望:13
帖 子:1582
专家分:116
注 册:2006-12-7
得分:0 
恩````去看看````

女施主``我给你``送茶来了```师太``你就从了老衲吧``
代码本天成~~~妙头偶得之```
2007-11-26 12:41
死了都要C
Rank: 4
来 自:四川成都
等 级:贵宾
威 望:13
帖 子:1582
专家分:116
注 册:2006-12-7
得分:0 
刚才搜了好多啊``都找不到啊````55555``能给个网址吗?~``

女施主``我给你``送茶来了```师太``你就从了老衲吧``
代码本天成~~~妙头偶得之```
2007-11-26 13:09
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
clogSee Also
<iostream> Members | ostream
Specifies the clog global stream.

extern ostream clog;
Return Value
An ostream object.

Remarks
The object controls buffered insertions to the standard error output as a byte stream.

Example
See cerr for an example of using clog.

————————————————————————————————————
cerrSee Also
<iostream> Members | ostream
Specifies the cerr global stream.

extern ostream cerr;
Return Value
An ostream object.

Remarks
The object controls unbuffered insertions to the standard error output as a byte stream. Once the object is constructed, the expression cerr.flags & unitbuf is nonzero.

Example
// iostream_cerr.cpp
// compile with: /EHsc
// By default, cerr and clog are the same as cout
#include <iostream>
#include <fstream>

using namespace std;

void TestWide( )
{
   int i = 0;
   wcout << L"Enter a number: ";
   wcin >> i;
   wcerr << L"test for wcerr" << endl;
   wclog << L"test for wclog" << endl;   
}

int main( )
{
   int i = 0;
   cout << "Enter a number: ";
   cin >> i;
   cerr << "test for cerr" << endl;
   clog << "test for clog" << endl;
   TestWide( );
}
Input
3
1
Sample Output
Enter a number: 3
test for cerr
test for clog
Enter a number: 1
test for wcerr
test for wclog

Fight  to win  or  die...
2007-11-26 13:15
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
得分:0 
简单来说就是clog带缓冲区,cerr不带,均为标准错误流。

重定向就是指cout可以用于输出到显示器以外的设备关联,比如文件。

[[italic] 本帖最后由 aipb2007 于 2007-11-26 13:30 编辑 [/italic]]

Fight  to win  or  die...
2007-11-26 13:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-188284-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.385348 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved