Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

template<class T>
static T EndianUtil< T >::read ( istream &  is  )  [inline, static]

Read procedure, C++ I/O version.

Parameters:
is the stream to read from.
Returns:
the first element readed from the current position of the stream

Definition at line 73 of file EndianUtil.H.

  {
    T retval;
#if __BYTE_ORDER == __BIG_ENDIAN
    is.read((char *) &retval, sizeof(T));
#else
    char *s = reinterpret_cast<char *>(&retval);

    for(int i = sizeof(T)-1; i != -1; i--)
    {
      is.read(&(s[i]), sizeof(char));
    } 
#endif
    return retval;    
  }


Generated by  Doxygen 1.6.0   Back to index