/****************************************************************************** $Id: IO.c,v 1.1 2013/02/14 16:58:03 pascal Exp $ Those fonctions performs IO swapping between big-endian and little endian representation. *****************************************************************************/ #include #include #include "config.h" #include "EndianSwap/IO.h" #include "EndianSwap/swapint.h" #include "EndianSwap/swapfloat.h" /****************************************************************************** ES_fwrite_short ############### Write short values to a file from little-endian memory representation to big endian representation in file. The writing is performed like the standard fwrite function. IN: const short *buf : pointer to the short values to write size_t nmemb : number of values to write. INOUT: FILE * stream : stream to write the data. RETURN: size_t : the number of short values successfully written. *****************************************************************************/ size_t ES_fwrite_short(const short * buf, size_t nmemb, FILE * stream) { short *tmp_buf; tmp_buf = (short *) malloc(nmemb*sizeof(short)); memcpy(tmp_buf, buf, sizeof(short)*nmemb); { int i; for(i=0; i