MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: BinaryWrite[...] / OpenWrite[...] / random access in file

  • To: mathgroup at
  • Subject: [mg120773] Re: BinaryWrite[...] / OpenWrite[...] / random access in file
  • From: David Bailey <dave at>
  • Date: Tue, 9 Aug 2011 07:22:13 -0400 (EDT)
  • Delivered-to:
  • References: <j1o68m$4gb$>

On 08/08/2011 09:20, Scot T. Martin wrote:
> Does anyone know if it's possible to use OpenWrite[...], or related functions like BinaryWrite[...], without erasing the existing file?
> That is, I have a huge file that I do not want to load into memory; I just want to write over 16 bytes at a specific position in the file.
> It seems to me that this should be possible, but I do not find the options/commands to do so.
> Anyone suggestions? Am I missing something obvious here?
Surprisingly, this doesn't seem possible - indeed SetStreamPosition only 
seems to operate on input streams, so you would not be able to position 
for the 16-byte write.

Under 8.0, you can link a C DLL into Mathematica dynamically, so that 
would be one way to get the effect you require. Alternatively, you could 
do the job using J/Link to access the relevant Java I/O routines.

David Bailey

  • Prev by Date: Re: Getting TraditionalForm to put in a multiplication sign.
  • Next by Date: Re: Animation
  • Previous by thread: BinaryWrite[...] / OpenWrite[...] / random access in file
  • Next by thread: Animation