Question On Endianness And Solaris Sparc Versus IA32 File Systems - Solaris

This is a discussion on Question On Endianness And Solaris Sparc Versus IA32 File Systems - Solaris ; Gentle People: I have found an interesting Endinness issue. On both Solaris 8 Sparc and Solaris 8 IA32 machines when I read the same file sequentially using getc() and I get different results in byte ordering because of the Big ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Question On Endianness And Solaris Sparc Versus IA32 File Systems

  1. Question On Endianness And Solaris Sparc Versus IA32 File Systems

    Gentle People:

    I have found an interesting Endinness issue.

    On both Solaris 8 Sparc and Solaris 8 IA32
    machines when I read the same file sequentially
    using getc() and I get different results in byte
    ordering because of the Big Endian (Sparc) versus
    Little Endian (Intel) file system data organization.

    Question is there any way to automatically
    compensate for this with getc??? Or more obviously
    do I just have to rewrite the software application
    to compensate for this?

    Thanks for the help
    Thomas Dineen


  2. Re: Question On Endianness And Solaris Sparc Versus IA32 FileSystems

    There is no way you can automatically compensate for this. It depends
    entirely on the data contained in the file.

    If all the data are 1 byte wide, like in an ascii file, there is
    nothing you need to do, it is already correct for. If it contains only
    2 byte shorts, then you need to swap them pairwise, if they are 4 byte
    ints, you need to do quad swapping, etc. Frequently the data is a mix
    of data types, and unless you know exactly how it is laid out, you
    can't work around the problem in any simple manner.

    This has nothing to do with the filesystem type, it is only a problem
    of the file content.



+ Reply to Thread