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

template<class T>
static void EndianUtil< T >::write ( FILE *  output,
T const &  val 
) [inline, static]

Write procedure.

Parameters:
output the stream to write to
val the value of the generic object to write to the stream

Definition at line 94 of file EndianUtil.H.

  {
    T val2 = val;
#if __BYTE_ORDER == __BIG_ENDIAN
    fwrite(&val2, sizeof(T), 1, output);
#else
    char *s = reinterpret_cast<char *>(&val2);
    
    for(int i = sizeof(T)-1; i != -1; i--)
    {
      fwrite(&(s[i]), 1, 1, output);
    }
#endif
  }


Generated by  Doxygen 1.6.0   Back to index