On Aug 15, 2008, at 18:10 , FTB Accounts wrote:
Devon, thanks for your response. However, your suggestion still does not make the code work. No data is written to the file./* WRITE DATA TO FILE: THIS IS A TEST */ [fh writeData:@"THIS IS A TEST"]; [fh closeFile];I simply was copying the advice given on a previous post. I have tried just about everything and can get nothing to work? has anyone on this list ever had success in writing to a local file, and if so can you show me the code you used?
Adding the @ just makes it an NSString constant... but writeData still requires (NSData *), not (NSString *). As was pointed out before, are you sure that you have write permissions here? You should check your errors... also, try writing the location with basic system calls (just to test briefly) and check the return result and the
errno to see what might be the issue...?Following up on what another poster suggested, is it possible to do this another way? For instance, if you are storing strings and binary data, is it possible to write this file using an (NSMutableDictionary *)? You could write both your strings (NSString *) and data (NSData *) to a structure in memory (if you don't have keyed data, just use (NSMutableArray *) instead of (NSMutableDictionary *). If you're afraid of losing data or have to share the data through the file, maybe you could flush it every time you make a change? Both the array and the dictionary respond to - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
/jason
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]