MathGroup Archive 2004

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

Search the Archive

Re: Reads in only part of file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51176] Re: Reads in only part of file
  • From: "Mariusz Jankowski" <mjankowski at usm.maine.edu>
  • Date: Thu, 7 Oct 2004 05:26:01 -0400 (EDT)
  • Organization: University of Southern Maine
  • References: <ck0c50$nvp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Steve, use the option DOSTextFormat -> True. This an option of OpenStream so
you must do

stream = OpenStream[ st1, DOSTextFormat -> True]
xin = ReadList[stream, {Byte, Byte}]
 

Good luck, Mariusz





>>> Steve Gray<stevebg at adelphia.net> 10/6/2004 4:59:12 AM >>>
I have a binary file of 945 coordinates, in X,Y pairs, each value being 8
bits, for 1890
bytes total. I have examined the file with a hex file display and editor
(which shows the file as 2
hex characters per byte) and confirms that the file contains exactly the
expected number of bytes.
My input process is:

roswin[nv_]:=  Module[{st1}, 
         nverts = nv; 
         st1="D:\Math\Geometry\Combinatorial
Geom\Oswin\Otypes\otypes07.b08";
         Print["Reading file: ",st1];
         xin=ReadList[st1,{Byte,Byte}];
    ]

The file opens ok but the input list xin contains only 230 coordinate pairs
(byte pairs) instead of
945. The values that do read in are correct. The {Byte,Byte} seems to be the
only data type that
works here. Can anyone suggest what I am doing wrong? (Do I have to Close
st1?) Thank you for any
tips.

Steve Gray




  • Prev by Date: Re: solve and simplify. force left hand side to be 0==
  • Next by Date: Re: notation for integration limits
  • Previous by thread: Reads in only part of file
  • Next by thread: Re: Reads in only part of file