C# unsafe void ReadSingleBuffer(float[] s_buffer) { int count = s_buffer.Length * 4; byte[] m_buffer = new byte[count]; br.Read(m_buffer, 0, count); //convert byte -> single for (int i = 0; i < s_buffer.Length; ++i) { uint num = (uint)(((m_buffer[0 + i * 4] | (m_buffer[1 + i * 4] << 8)) | (m_buffer[2 + i * 4] << 0x10)) | (m_buffer[3 + i * 4] << 0x18)); s_buffer[i] = *(((float*)&num)); } }
C# br = new BinaryReader(fs, System.Text.Encoding.GetEncoding(1251))... br.ReadBytes(54); this.progHeader1 = ReadString(75); this.progHeader2 = ReadString(75); br.ReadBytes(12); ReadInt32Buffer(numb); nx = numb[43]; ny = numb[44]; nz = numb[45]; br.ReadBytes(12);
C++ (Qt)void DataLoader::readFloatbuffer(QFile &f, float* f_buffer, int len){ char m_buffer[len * 4]; f.read(m_buffer, len * 4); for (int i = 0; i < len; ++i) f_buffer[i] = *(float*)(&m_buffer[i * 4]);}
C++ (Qt) QFile file(fname); file.open(QIODevice::ReadOnly);... file.read(54); progHeader1 = readString(file, 75); progHeader2 = readString(file, 75); file.read(12); readInt32buffer(file, numb, 100); nx = numb[43]; ny = numb[44]; nz = numb[45]; file.read(12);
C++ (Qt)void DataLoader::readFloatbuffer(QFile &f, float* f_buffer, int len){ f.read( (char*)f_buffer, len * sizeof( *f_buffer ) );}
C++ (Qt)float GLView::readFloat(QFile &f){ char m_buffer[4]; f.read(m_buffer, 4); return *((float*)m_buffer);}
C++ (Qt)float GLView::readFloat(QFile &f){ float val; f.read((char*)&val, sizeof(val)); return val;}
C++ (Qt)void GLView::readFloat(QFile &f,float& x){ f.read(&x, 4);}