• 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
Re: File Manipulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Manipulation


  • Subject: Re: File Manipulation
  • From: Oleg Svirgstin <email@hidden>
  • Date: Mon, 10 Mar 2003 11:56:53 +0300

NSFileHandle.

It is possible use plain C to do things with files (someone might call it
UNIX).
Oe even the C++ streams (naming the source file to do this as ".mm" or even
".cp" if that file will contain no Obj-C)
There are many other ways, (several of them in Carbon).

Most likely it is the best to go with instances of NSFileHandle.

Regards
Oleg



> From: Seth Willits <email@hidden>
> Date: Mon, 10 Mar 2003 00:05:30 -0800
> To: email@hidden
> Subject: File Manipulation
>
> I'm writing an app which will open two files and modify the contents of
> one file based on the other (a simple patching utility). Everything is
> going well so far, but I'm just now getting to the file manipulation.
>
> It seems to me that I should open the patch file into an NSData object
> and the original file into an NSMutableData object. I'm attempting to
> read bytes from the NSData object using subdataFromRange and then set
> some bytes in the NSMutableData object, but I wonder, if this is the
> best way. Also, I'm trying to figure out how to get the integer value
> of a specific range of bytes in the NSData object. If the three bytes
> are "A9B" then I need to get the hex value which would be 2715. Would
> it be easier to simply work with strings?
>
> Also, another question. Can I open a file as stream and read as I go
> along instead of reading it all into memory at once? Similarly, can I
> write to a specific byte offset in a file (overwriting the given amount
> of bytes) without having to open that file in memory, swap the data,
> and then write the file out?
>
> Thanks,
>
>
> Seth Willits
> ------------------------------------------------------------------------
> ---
> President and Head Developer of Freak Software - http://www.freaksw.com
> Q&A Columnist for REALbasic Developer Magazine -
> http://www.rbdeveloper.com
>
> "Standing up for what you believe in is never a waste of time."
> -- Seth Willits
> ------------------------------------------------------------------------
> ---
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >File Manipulation (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Need guidance in table sorting
  • Next by Date: Re: Adding scripting support to Cocoa applications
  • Previous by thread: File Manipulation
  • Next by thread: Application with documents
  • Index(es):
    • Date
    • Thread