   Using stderr properly
  Well, my game's coming along quite nicely. Though I gave what's been done so far to my friend for a quick test, and whaddaya know. It puked. 'Cause, he was using XP actually. It's fixed though. My point is I put in a debugging class for future use because of that. I'm using a redirected stderr (as I don't have a console) to write out an error log, but as of now I know for sure that this only works with client handled errors (such as an int not being what it's supposed to). What I want to know is how to get this working for unexpected dumps where you get the automated message "Client has performed an illegal operation in~". Here's what I've got so far for my error handling class:error.cpp#ifdef _DEBUG_CLIENT_#include <time.h>#include "error.h"DebugIO::DebugIO(char* FN){   FileName = FN;   Debug = false;}DebugIO::~DebugIO(){   if(Debug) fprintf(stderr,"\n\n");   delete FileName;}void DebugIO::Open(){   file = freopen(FileName,"a",stderr);   isOpen = true;   time_t TIME_t = time(0);   tm* TIME = localtime(&TIME_t);   fprintf(stderr,"Error log, dated: %i %i %i %i %i\n",TIME->tm_wday,TIME->tm_hour,TIME->tm_min ,TIME->tm_sec ,TIME->tm_year);}void DebugIO::Write(const char* output){   fprintf(stderr,"%s",output);}#endiferror.h#ifdef _DEBUG_CLIENT_#ifndef _ERROR_H_#define _ERROR_H_#include <stdio.h>class DebugIO{   private:   char* FileName;   FILE* file;   public:   DebugIO(char*);   ~DebugIO();   void Open();   void Write(const char*);   bool Debug;   bool isOpen;   int check[32];};#endif#endifAnd a quick example of it being used: #ifdef _DEBUG_CLIENT_    if(!renderBG() && error->Debug)    {  if(!error->isOpen)error->Open();  error->Write("Client failed at line 69 in file game.cpp");  glCleanUp();    } #else    renderBG(); #endifAny and all help is appreciated. Now if you'll excuse me, there's a pop-up telling me I have 1 FREE screen saver waiting! Amagad!-Etyrn   
  Im not sure I get exactly what you mean but when you sayQuote:"Client has performed an illegal operation in~"This looks like one of those runtime address violation errors.If thats the case, the only way I know of to handle those is to initialize every pointer you create to NULL, and check them before you use them. Eg. make sure they  dont equal NULL.This method is not safe if you forget to initialize your pointers to NULL.One thing I would consider was to reduce the use of pointers to a minimum, and when you have to use a pointer, use the auto_ptr that comes with the C++ standard library.[Edited by - pulpfist on June 5, 2006 3:37:19 AM];  Alrighty. You've been a lot of help. Thanks!-Etyrn   ;  Structured Exception Handling can be used to trap those/similar errors (this differs from regular C++ exception handling in that it is not a language standard and is slightly more cumbersome; however, it allows you to catch errors you cannot catch with regular exceptions and collect a lot of useful debugging information.   