Lance Dillon wrote:
>Stdio.File fp;fp=Stdio.File(filename,"r");string str=fp->read(2);int 
>res=array_sscanf(reverse(str),"%2c")[0];

Using %2c to read little endian probably only works on CPUs that are
little endian to begin with.

>Trying to find an easy way to make it variable, like 2 or 4 byte ints (there 
>are some DWORDs in the file too).?? array_sscanf doesn't take parameters for 
>the format, so I can't do "%*c",2 .

The best you can do at the moment, would be to read the whole
file into a Stdio.Buffer, and then use read_int8() to pick it apart.

We could extend Stdio.Buffer.read_int() to support what has been discussed
before, that when you specify n<0, it would do little endian instead
of big endian.
-- 
Stephen.
  • lit... Lance Dillon
    • ... Stephen R. van den Berg
      • ... Tobias S. Josefowitz
        • ... Lance Dillon
          • ... Lance Dillon
            • ... Stephen R. van den Berg
        • ... Stephen R. van den Berg
      • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
        • ... Lance Dillon
          • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum
            • ... Lance Dillon
    • ... Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum

Reply via email to