create a file appending data
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