请amo,cakk帮我结束该问题,我已解决! (30分)

  • 主题发起人 主题发起人 狼牙
  • 开始时间 开始时间

狼牙

Unregistered / Unconfirmed
GUEST, unregistred user!
//各位看看这段c代码如何转换成pascal代码阿?读取二进制。。<br>file*fp_addr <br>char*srcname <br>char headbuf[0x41],recbuf[0xb1] <br>int i; <br>if(fp_addr=fopen(srcname,"rb"))==null) <br>{exit(-1)} <br>fseek(fp_addr,0x40,seek_set) <br>while(!feof(fp_addr)) <br>{ <br>char name[0x21],email[0x41] <br>for(i=0;i&lt;0x21;i++) <br>name='/0' <br>for(i=0;i&lt;0x41;i++) <br>email='/0' <br>fread(recbuf,1,0xb0,fp_addr) <br>if(recbuf[0x4]==1) <br>{continue;} <br>if(recbuf[0x11]==1) <br>{continue;} <br>for(i=0;i&lt;recbuf[0x21],i++) <br>{ <br>if(recbuf[i+0x13]==0)break <br>name=recbuf[i+0x13] <br>} <br>for(i=0;i&lt;recbuf[0x33],i++) <br>{ <br>if(recbuf[i+0x34]==0)break <br>email=recbuf[i+0x34] <br>} <br>/**/ <br>} <br>fclose(fp_addr) <br>
 
这是我自己转后的代码,不行。呵呵。怎么办?<br>最后的目的要把name,email的内容写到memo中去,大家看看 ,怎么办阿?<br>var<br>&nbsp; headbuf:array[0..$41] of char;<br>&nbsp; recbuf:array[0..$b1] of char;<br>&nbsp; name:array[0..$21] of char;<br>&nbsp; email:array[0..$41] of char;<br>&nbsp; f:file;<br>&nbsp; i:integer;<br>begin<br>&nbsp; AssignFile(F,ExtractFilePath(application.ExeName)+'address.ind');<br>// &nbsp;f:=tfilestream.Create(ExtractFilePath(application.ExeName)+'address.ind',fmOpenReadWrite);<br>&nbsp; reset(f,1);<br>&nbsp; seek(f,$40);<br>&nbsp; while not eof(f) do<br>&nbsp; begin<br>&nbsp; &nbsp; for i :=0 &nbsp;to $21 &nbsp;do<br>&nbsp; &nbsp; &nbsp; name:=char(0);<br>&nbsp; &nbsp; for i:=0 &nbsp;to $41 do<br>&nbsp; &nbsp; &nbsp; email:=char(0);<br>&nbsp; &nbsp; //BlockRead(FromF, Buf, SizeOf(Buf), NumRead);<br>&nbsp; &nbsp; Blockread(f,recbuf,$b0);<br><br>&nbsp; &nbsp; if recbuf[$4]='1' then continue;<br>&nbsp; &nbsp; if recbuf[$11]='1' then continue;<br>&nbsp; &nbsp; for i:=0 to recbuf[$21] do//这里出错。integer和char不兼容性。<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; name:=recbuf[i+$13];<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; for i:=0 to recbuf[$33] do<br>&nbsp; &nbsp; &nbsp; email:=recbuf[i+$34];<br>&nbsp; &nbsp; memo1.Lines.Add(name);<br>&nbsp; &nbsp; memo1.Lines.Add('********************');<br>&nbsp; &nbsp; memo1.Lines.Add(email);<br>&nbsp; end;<br>&nbsp; closefile(f);<br>end;
 
已解决代码入下,请求斑竹结束。。。。多谢。<br><br>var<br>&nbsp; headbuf:array[0..$41] of char;<br>&nbsp; recbuf:array[0..$b1] of char;<br>&nbsp; name:array[0..$21] of char;<br>&nbsp; email:array[0..$41] of char;<br>&nbsp; f:file;<br>&nbsp; i:integer;<br>begin<br>&nbsp; AssignFile(F,ExtractFilePath(application.ExeName)+'address.ind');<br>// &nbsp;f:=tfilestream.Create(ExtractFilePath(application.ExeName)+'address.ind',fmOpenReadWrite);<br>&nbsp; reset(f,1);<br>&nbsp; seek(f,$40);<br>&nbsp; while not eof(f) do<br>&nbsp; begin<br>&nbsp; &nbsp; for i :=0 &nbsp;to $21 &nbsp;do<br>&nbsp; &nbsp; &nbsp; name:=char(0);<br>&nbsp; &nbsp; for i:=0 &nbsp;to $41 do<br>&nbsp; &nbsp; &nbsp; email:=char(0);<br>&nbsp; &nbsp; //BlockRead(FromF, Buf, SizeOf(Buf), NumRead);<br>&nbsp; &nbsp; Blockread(f,recbuf,$b0);<br><br>&nbsp; &nbsp; if recbuf[$4]='1' then continue;<br>&nbsp; &nbsp; if recbuf[$11]='1' then continue;<br>&nbsp; &nbsp; for i:=0 to ord(recbuf[$21]) do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; name:=recbuf[i+$13];<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; for i:=0 to ord(recbuf[$33]) do<br>&nbsp; &nbsp; &nbsp; email:=recbuf[i+$34];<br>&nbsp; &nbsp; memo1.Lines.Add(name);<br>&nbsp; &nbsp; memo1.Lines.Add('********************');<br>&nbsp; &nbsp; memo1.Lines.Add(email);<br>&nbsp; end;<br>&nbsp; closefile(f);<br>end;
 
请amo,cakk帮我结束该问题,我已解决!
 
后退
顶部