• 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
create a file appending data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

create a file appending data


  • Subject: create a file appending data
  • From: Yorh <email@hidden>
  • Date: Tue, 13 Jun 2006 11:02:52 +0200

Hi to all,

I need to create a file by appending data that comes from a socket.
I have these two methods:

-(void)acceptFile:(NSString*)aPath{
[[NSFileManager defaultManager] createFileAtPath:[NSString stringWithFormat:@"%@/%@",NSHomeDirectory(),[self file]] contents:nil attributes:nil];
theHandler = [NSFileHandle fileHandleForWritingAtPath:[NSString stringWithFormat:@"%@/%@",NSHomeDirectory(),aPath]];
[self setHandler:theHandler]; // I need this one to have the reference of the handler
}
-(void)handlerFileData:(NSMutableData*)data{


	NSRange theRange;
	theRange.location = 2;
	theRange.length = ([data length]-2);
	NSData * tmpData = [data subdataWithRange:theRange];
	[[self theHandler] writeData:tmpData];

}

All seems good , but when the download starts the application crash... :(

Anyone knows why?

Thank you all
Yorh

_______________________________________________
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


  • Prev by Date: Newbie Q : getting rid of MyDocument
  • Next by Date: set alternate increment on nsslider
  • Previous by thread: Re: Newbie Q : getting rid of MyDocument
  • Next by thread: set alternate increment on nsslider
  • Index(es):
    • Date
    • Thread