|
From: Daniel G. <sp...@ho...> - 2002-07-31 09:47:31
|
A little of the code:
// A CLASS CONSTRUCTOR
AddPrinterDialog::AddPrinterDialog()
{
mAddPrinterDialogPointer = NULL;
mPointerToParent = NULL;
/* If this pointer has failed to be assigned as specified then
construction has failed (object cannot, and therefore never
has, existed.
*/
if ( mAddPrinterDialogPointer != NULL )
{
Exception ThrownObject( "AddPrinterDialog construction failed.", 31
); // Error code 31
throw ThrownObject;
}
else
{
; // Do nothing
}
}
Of course this thrown exception would be caught etc. and SetErrorLog would
be called (below).
void Exception::SetErrorLog( Exception &Obj )
{
ofstream ExceptionOfstreamObject; // For managing the text file
// Create and name the text file
ExceptionOfstreamObject.open( _T("Exception Caught Log.txt") );
ExceptionOfstreamObject << Obj.GetErrorString() << endl;
ExceptionOfstreamObject << Obj.GetErrorCode() << endl;
ExceptionOfstreamObject.close();
}
That's the cuurent code. You can see why I want the obj to pass itself. I
have a workaround, I just wondered if it was possible.
>From: "Abhijit Shylanath" <mu...@gm...>
>To: "Daniel Glenfield"
><sp...@ho...>,<dev...@li...>
>Subject: Re: [Dev-C++] Object passing itself
>Date: Wed, 31 Jul 2002 02:49:47 +0530
>
> > Ah, but Obj has two data members, which are a text string (which details
>the
> > precise error) and an integer (which is the error code). SetErrorLog()
> > outputs this information to a text file.
>
>I still don't get it... won't this do?
>
>void Exception::SetErrorLog()
>{
> ofstream f("log.txt");
> f << text_string << endl;
> f << "Error-code " << err_code << endl;
>}
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by: Dice - The leading online job board
>for high-tech professionals. Search and apply for tech jobs today!
>http://seeker.dice.com/seeker.epl?rel_code=31
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
|