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

template<class T>
static T EndianUtil< T >::read ( FILE *  input  )  [inline, static]

Read procedure.

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

Definition at line 52 of file EndianUtil.H.

  {
    T retval;
#if __BYTE_ORDER == __BIG_ENDIAN
    fread(&retval, sizeof(T), 1, input);
#else
    char *s = reinterpret_cast<char *>(&retval);

    for(int i = sizeof(T)-1; i != -1; i--)
    {
      fread(&(s[i]), 1, 1, input);
    } 
#endif
    return retval;
  }


Generated by  Doxygen 1.6.0   Back to index