D
DeityFox
Unregistered / Unconfirmed
GUEST, unregistred user!
++代码:<br>AREAINFO m_AreaInfo[100];<br>int m_AreaCount = 89;<br>char m_grpBuffer[128 * 1024];<br>DWORD *dwOfsList = (DWORD*)&m_grpBuffer[12]; <br><br>char * GetStreamPtr( int id )<br>{<br> if( id < 0 || id >= m_AreaCount * 2 + 2 )<br> return NULL;<br> return (&m_grpBuffer[dwOfsList[id * 2]]);<br>}<br><br>我改成下面的代码,错误是dwOfsList不能进行[]操作,必须数组才行<br>var<br> m_grpBuffer:array[0..128*1024-1] of char;<br> m_AreaCount:integer;<br> dwOfsListDWORD;<br><br>function TForm1.GetStreamPtr(id: integer): pchar;<br>begin<br> dwOfsList := PDWord(@m_grpBuffer[12]);<br> if (id<0) or (id>= m_AreaCount * 2 + 2) then<br> Result:=nil<br> else<br> Result:=@(m_grpBuffer[dwOfsList[id * 2]]);<br><br>end;<br>//Result:=@(m_grpBuffer[dwOfsList[id * 2]]); 错误!<br>//Array type required<br>