• 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: init char buffer to null
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: init char buffer to null


  • Subject: Re: init char buffer to null
  • From: Nir Soffer <email@hidden>
  • Date: Thu, 14 Dec 2006 00:29:02 +0200


On Dec 13, 2006, at 05:51, Sandro Noel wrote:

Well simply put i'm trying to read bytes from a file, recursively,
so the buffer will be freed right after use...

Does this work for you?

NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:@"foo"];

	while (needsMoreData) {
		NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

		NSData *buffer = [fileHandle readDataOfLength:bufferLength];

		// Handle the buffer

		[pool release];
	}


it is not static because i have no clue on how big the string i will have to read is,
might be half a file, or just a quarter... and the file is Bytes Data.
unless it's a very bad way of doing it.

It is not clear what the file contain and how do you detect the start and the end of that "string".



i'll try out memset.

thank you much...i read about calloc witch has better performance... should i use that ?

Shark will tell you that.


Best Regards,

Nir Soffer

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >init char buffer to null (From: Sandro Noel <email@hidden>)
 >Re: init char buffer to null (From: Chris Suter <email@hidden>)
 >Re: init char buffer to null (From: Sandro Noel <email@hidden>)

  • Prev by Date: Database Application?
  • Next by Date: how to get validation?
  • Previous by thread: Re: init char buffer to null
  • Next by thread: Re: init char buffer to null
  • Index(es):
    • Date
    • Thread