• 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: Reading return values from NSTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading return values from NSTask


  • Subject: Re: Reading return values from NSTask
  • From: j o a r <email@hidden>
  • Date: Mon, 29 Dec 2003 00:26:48 +0100

On 2003-12-28, at 23.40, KLW wrote:

> outString = [outString initWithData:inData
> encoding:NSASCIIStringEncoding];

You have already allocated and initialized the "outString" string, so
you can't do it over and over again like this. Try something like this:

=====================================================
[task launch];
// [task waitUntilExit]; // Use this if you can

NSData *data;
while ((inData = [readHandle availableData]) && [inData length])
{
NSString *s = [[[NSString alloc] initWithData: inData encoding:
[NSString defaultCStringEncoding]] autorelease];
[outString appendString: s];
}
NSLog(outString);
=====================================================

What type of problems is it that you see?

j o a r

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >genstrings not working (From: David Kocher <email@hidden>)
 >Re: genstrings not working (From: "Louis C. Sacha" <email@hidden>)
 >Reading return values from NSTask (From: KLW <email@hidden>)

  • Prev by Date: Re: reloading individual rows in tableview
  • Next by Date: Frameworks
  • Previous by thread: Reading return values from NSTask
  • Next by thread: Re: Reading return values from NSTask
  • Index(es):
    • Date
    • Thread