View Full Version : Update file using OBjective C
Khanjan
Jun 25, 2009, 12:28 PM
Hey all,
I am building an interface for running some perl scripts. I want to display a file on the hard drive in the interface and update it on mouse click. I am able to display the file, however, I am not able to update it. I am new to Objective C. Can anyone please help me on how to update a file using Objective C ?
Thanks,
Khanjan
lee1210
Jun 25, 2009, 02:54 PM
You might need to be more specific. There are methods to grab a file with an NSData wrapper, or get a text file using NSString:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html#//apple_ref/occ/clm/NSData/dataWithContentsOfFile:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/clm/NSString/stringWithContentsOfFile:encoding:error:
And corresponding methods to write the contents of an NSData object or NSString to a file:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html#//apple_ref/occ/instm/NSData/writeToFile:atomically:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/writeToFile:atomically:encoding:error:
Does this help?
-Lee
Khanjan
Jun 30, 2009, 12:18 PM
Thanks a ton ... It worked... !!
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.