Re: BinaryIO
- To: mathgroup at smc.vnet.net
- Subject: [mg57818] Re: [mg57797] BinaryIO
- From: "Dale R. Horton" <daleh at wolfram.com>
- Date: Thu, 9 Jun 2005 05:18:00 -0400 (EDT)
- References: <200506080843.EAA13826@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
BinaryWrite is like Write. It does not close it's streams when it's finished. So the second BinaryWrite appends to the file. To overwrite, you should first close the stream. n = 1000000; TSout = Table[{FromDate[{2000, 1, 1, 0, 0, 0}] + i, Random[]}, {i, n}]; stream = OpenWrite["binTS.dat", BinaryFormat -> True]; BinaryWrite[stream, TSout, {"Real64", "Real64"}]; // Timing Close[stream]; TSin = BinaryReadList["binTS.dat", {"Real64", "Real64"}]; // Timing TSout == TSin -Dale On Jun 8, 2005, at 3:43 AM, Marko Kastens wrote: > Hi, > > I have just updated to Mathematica 5.1.1.0 and trying the new > BinaryIO-Commands to > increase the IO speed. But ... here is something strange: > > > n = 1000000; > TSout = Table[{FromDate[{2000, 1, 1, 0, 0, 0}] + i, Random[]}, {i, n}]; > BinaryWrite["binTS.dat", TSout, {"Real64", "Real64"}]; // Timing > TSin = BinaryReadList["binTS.dat", {"Real64", "Real64"}]; // Timing > TSout == TSin > > > Evaluating these lines with a fresh kernel: everything is ok. Evaluate > them a > second time and TSout==TSin produce a _False_. Restarting the kernel: > everything is ok. > Every time I (try to) overwrite the file _binTS.dat_ I got a False. It > seems to > me that the routine is not able to overwrite files. > > Hmmm, any suggestions? > > marko >
- References:
- BinaryIO
- From: Kastens@Hamburg.BAW.DE (Marko Kastens)
- BinaryIO