Re: Standard Input/Output
Re: Standard Input/Output
- Subject: Re: Standard Input/Output
- From: Karl Kraft <email@hidden>
- Date: Sun, 18 Sep 2005 20:24:17 -0700
On Sep 18, 2005, at 8:17 PM, Lachlan Cotter wrote:
Thanks Tommy. I thought there might be some kind of wrapper for
this like NSPipe or NSStream or something like that. I couldn't
find anything in the documentation. Am I missing something?
Pulled from my archives. Use at your own risk
static FILE *loggingFile = NULL;
void QLog (NSString* format, ...)
{
va_list ap;
FILE *outputFile;
outputFile = loggingFile;
if (outputFile == NULL) outputFile = stderr;
va_start (ap, format);
if (![format hasSuffix: @"\n"])
format = [format stringByAppendingString: @"\n"];
fprintf(outputFile,"%s",[[[[NSString alloc]initWithFormat: format
arguments: ap]autorelease] lossyCString]);
va_end (ap);
}
Allows you to do:
QLog(@"The value is %@",someObject);
If you want stdout instead of stderr, then change the ref to stderr
above.
--
K2 // Karl Kraft // email@hidden // AIM: nfoxsupport
To purchase it is not like spending money, but rather it is an
investment in the future, in a blow against the empire
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden