• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Standard Input/Output
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Standard Input/Output (From: Lachlan Cotter <email@hidden>)
 >Re: Standard Input/Output (From: Tommy Nordgren <email@hidden>)
 >Re: Standard Input/Output (From: Lachlan Cotter <email@hidden>)

  • Prev by Date: Re: Standard Input/Output
  • Next by Date: willChangeValueForKey, Ivars and Core Data
  • Previous by thread: Re: Standard Input/Output
  • Next by thread: Re: Standard Input/Output
  • Index(es):
    • Date
    • Thread