MathGroup Archive 1999

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

Search the Archive

Re: ReadListBinary -- Is this a bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17961] Re: [mg17947] ReadListBinary -- Is this a bug?
  • From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
  • Date: Mon, 7 Jun 1999 02:51:19 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

In[1]:=
<<Utilities`BinaryFiles`

In[2]:=
Attributes[ReadListBinary]
Out[2]=
{HoldRest}

This means ReadListBinary evaluates only its first argument. So you need to
use:


kk = 20;
data  = ReadListBinary[stream,Byte,Evaluate[kk]];

Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp
http://eri2.tuins.ac.jp


----------
>From: Virgil Stokes <virgil.stokes at neuro.ki.se>
To: mathgroup at smc.vnet.net
>To: mathgroup at smc.vnet.net
>Subject: [mg17961] [mg17947] ReadListBinary -- Is this a bug?
>Date: Sat, Jun 5, 1999, 3:56 PM
>

> The following Mathematica code when
> using Mathematica 3.0 produces unexpected results.
>
>   <<Utilities`BinaryFiles`;
>   Remove[data,stream];
>
>   data = Table[n,{n,10,100}]
>
>   stream = OpenWriteBinary["TestFile"]
>
>   WriteBinary[stream,data,ByteConversion->Identity]
>   WriteBinary[stream,data,ByteConversion->Identity]
>   Close[stream];
>
>   stream = OpenReadBinary["TestFile"];
>   SetStreamPosition[stream,20];
>   data = ReadListBinary[stream,Byte,20]
>
>   StreamPosition[stream]
>   SetStreamPosition[stream,0];
>
>   kk = 20;
>   data  = ReadListBinary[stream,Byte,kk] (* why doesn't this work? *)
>   data = ReadListBinary[stream,Byte,20] (* while this works as expected *)
>   SetStreamPosition[stream,0];
>   data = ReadListBinary[stream,Byte]
>
>   Close[stream]
>
> What is puzzling is that the above ReadlListBinary[stream,Byte,kk]
> does not execute as I would expect. It seems that the number of instances
> parameter
> for the ReadListBinary can not be symbolic -- why?.
>
> -- Virgil
>
> 


  • Prev by Date: Re: Question on symbols in modules
  • Next by Date: Q: Animation
  • Previous by thread: ReadListBinary -- Is this a bug?
  • Next by thread: Early Results from Mathematica 4.0