Update file using OBjective C

Discussion in 'Mac Programming' started by Khanjan, Jun 25, 2009.

  1. macrumors newbie

    Joined:
    Jun 25, 2009
    #1
    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
     
  2. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    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/document...le_ref/occ/clm/NSData/dataWithContentsOfFile:
    http://developer.apple.com/document...ring/stringWithContentsOfFile:encoding:error:

    And corresponding methods to write the contents of an NSData object or NSString to a file:
    http://developer.apple.com/document..._ref/occ/instm/NSData/writeToFile:atomically:
    http://developer.apple.com/document...String/writeToFile:atomically:encoding:error:

    Does this help?

    -Lee
     
  3. thread starter macrumors newbie

    Joined:
    Jun 25, 2009
    #3
    Thanks a ton ... It worked... !!
     

Share This Page