避免乱入坑 留个记录~
1 m_pBin,m_pBink: array[0..19] of byte; 2 3 m_pbinx: PAnsiChar; 4 len: Integer ; 5 mStream: TStream; 6 begin 7 m_pbinx:= '1234567890abcdefgopq'; 8 Move(m_pbinx^, m_pBin, 20); 9 len:= Length(m_pBin); 10 mStream:= TMemoryStream.create; 11 mStream.Position:= 0; 12 mStream.Write(@m_pBin, len); 13 mStream.Position := 0; 14 mStream.Read(m_pBink, 20); 15 16 mStream.Free;
下面这个是存入一段字节集 从指定位置取出
mStream:= TMemoryStream.create; mStream.Position:= 0;//置指针为0 mStream.Write(ArgArray(pArgInf)[0].m_Value.m_pBin[i], n);//m_pbin的[i]位置开始到n位置存入数据流 mStream.Position := 0; mStream.Read(Dbyte, 15); //取出15位数据到dbyte mStream.Free; pRetData.m_Value.m_pBin:= @Dbyte;