A non-portable (doesn't work for big-endian machines) could be:An endian independent version requires a temporary buffer.Code:int32 arr[1000]; FILE* pF; for( int i = 0; i < 1000; ++i ) fwrite( &arr[i], 2, 1, pF );
Edit: I assume that you're sure that the elements only contains "16-bit values"?




Reply With Quote