.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
cout, cerr and clog in HL
Old
  (#1)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default cout, cerr and clog in HL - 01-09-2004

Does anybody know if Half-life is using these standard streams ? (cout, cerr and clog)

I'm asking because I want to redirect them to files and use them for logging and debuging purposes in my bot.
If HL used them, I could cause mess by redirecting them.

Also If someone is interested in redirecting, heres how it works :
Code:
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	clog << "Output to screen" << endl;

	ofstream mFile;
	streambuf *oldbuf=clog.rdbuf();

	mFile.open("filename.log");
	if(mFile) {
		if(mFile.rdbuf()->pubsetbuf(NULL,4096)==false)
			cerr << "error : cannot resize file buffer for clog" << endl;
		clog.rdbuf(mFile.rdbuf());
	}

	clog << "Output to file" << endl;

	// ...

	clog.flush();
	clog.rdbuf(oldbuf);
	mFile.close();
	clog << "Output back to screen" << endl;
	return 0;
}


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: cout, cerr and clog in HL
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: cout, cerr and clog in HL - 01-09-2004

stdout (and hence cout in C++) is used by the old retail Half-Life dedicated server, but you should still be able to redirect stdout (or cout) to a file.

Steam may or may not use stdout for the server console. I would guess that all of the engine output stuff is now routed to Steam I/O code which would get sent to the Steam GUI instead of the applications standard I/O stream.

botman
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com