473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

cerr and clog

Hello,

I am not entirely clear on the difference between cerr and clog. When it
is more appropriate to use one versus the other? I am coding a simple C++
application that will issue error and warning statements based on an
input, and I would like to know whether these should both go to cerr, or
whether clog for warnings is a more appropriate choice (or I suppose, just
cout)?

Thank-you,
Scott
Jun 16 '06 #1
1 4322
> I am not entirely clear on the difference between cerr and clog.

They only are tow different streams..
When it is more appropriate to use one versus the other? I am coding a simple C++ application that will issue error and warning statements based on an
input, and I would like to know whether these should both go to cerr, or
whether clog for warnings is a more appropriate choice (or I suppose, just
cout)?


Yes..
Some time ago, i red an article describing the way to get the streams into
different files using windows.

I've found this:

----------------------------------------------------------------------------------------------
Redirection, Pipes and Filters

Redirection
Directing output ( > ) from a program to a specific file or device
(different from the 'standard output' device: the screen).
Directing input ( < ) to a program from a specific file or device (different
from the 'standard input' device: the keyboard).
Pipe
A data-channel ( | ) in RAM that takes output from a program and feeds the
data as input to another program.
Filter
A program that accepts input data - does something to the data - and
delivers output data.
Both input and output may be redirected or piped.
DOS filters: find, more, sort

Examples:

dir > list.txt redirect output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, it is overwritten.
dir >> list.txt redirect and append output from dir to the file list.txt
- if the file does not exist, it is created
- if the file exists, output is appended to end of file.
sort < names.txt > list.txt use the file names.txt as input to sort
- output from sort is sent to the file list.txt.
dir | sort pipe output from dir to sort
- output from sort is sent to standard output: the screen.
dir | sort > c:\temp\list.txt - output from sort is sent to the file
c:\temp\list.txt.
dir | sort | more - output from sort is piped to more
- more (a filter) delivers output one screenfull at a time.

Redirection and pipes may be used in batch files.
-----------------------------------------------------------------------------------

but i can't remember how to split the streams... sorry

bye bye

Gnafu

Jun 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Fuzzyman | last post by:
Nappy clog month... no, not the usual USENET abuse - it's an anagram of comp.lang.python...... http://www.voidspace.org.uk/atlantibots/nanagram.html An anagram finder with Tkinter front end...
6
by: Mike - EMAIL IGNORED | last post by:
I have a VC++6.0 program than calls library functions that write to cerr. I would like to capture this output in the calling program. Would you please let me know how I could to this? If I...
2
by: Trevor | last post by:
Hello, Please bear with me, I am trying to learn C++. I am implementing some error/debug functions which format a message and output it to a C++ stream. I would like to design it using one low...
2
by: Agoston Bejo | last post by:
Hi, how can one redirect std::cerr into a file? Specifically, if I have an ofstream object, is there something I can do to make "cerr << ..." calls write into that particular ofstream object? ...
1
by: Gurikar | last post by:
How to redirect information to file usinf cerr or clog. Regards
8
by: Dylan | last post by:
What advantages does std::cerr offer over std::cout? (I'm trying to understand why it exists) thanks
8
by: sandwich_eater | last post by:
I get compiler error "cerr undeclared first use this function." #define err_ret(e) cerr << e; return -1 .... err_ret("who ate my muffy?");
3
by: Scott | last post by:
Hi All, I have a C++ program that uses a library. This library (which I also wrote in C++), writes a series of status messages to clog as it goes about its work. In my program which utilizes...
5
by: mich dobelman | last post by:
I am developing a web crawler which collects info from more than 50,0000 pages. but i am afraid this is going to clog the rental web server if I run it every single day. Is it possible to stop...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.