请问有没有api可以实现流的操作.有的话麻烦给我详细的参数意义.谢谢.
万分感谢.

解决方案 »

  1.   

    IStream是个接口需要自己封装过程建议还是用DELPHI自己的TStream类方便
      

  2.   

    TStream类在classes.pas中,如果包含此单元程序会变的很大,没有api可以实现象流一样的操作吗?
      

  3.   

    自己到VCL中把TStream相关的程序分离出来吧。
      

  4.   

    分离出来一样很大....
    只想得到类似操作的api..
    或者汇编代码也可以
    只要能使程序简短
      

  5.   

    keyz
    我要文件流,请指教以下.谢谢了
      

  6.   

    可以用API操作文件啊,不用流的方式。
      

  7.   

    keyz
    哪几个api?
    告诉我下,谢谢了.
    把参数的意义如果有时间也告诉我下.
    非常感谢
    感激不尽..
      

  8.   

    CreateFile: http://msdn2.microsoft.com/en-us/library/aa363858.aspx
    ReadFile: http://msdn2.microsoft.com/en-us/library/aa365467.aspx
    WriteFile: http://msdn2.microsoft.com/en-us/library/aa365747.aspx其他的你都可以在MS网站上找啊。
      

  9.   

    在WIN API中DELPHI的流就是其中的接口............晕倒,你自己可以写一个TSTREAM类啊.
      

  10.   

    写了,但是依旧很大,想用api.
    我想知道流中copyfrom方法用哪个api可以实现?
      

  11.   

    keyz把qq留给我好吗?我加你后请教.
      

  12.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      myfile,otherfile,mysize,othersize:int64;
    begin
      myfile:=fileopen(paramstr(0),fmopenreadwrite);
      mysize:=getfilesize(myfile,nil);
      otherfile:=fileopen('D:\test\m2winstall.exe',fmopenreadwrite or fmsharedenynone);
      FileWrite(otherfile,myfile,mysize);
    end;
    这样写哪里有不对吗?就是把自己复制到D:\test\m2winstall.exe里.
      

  13.   

    具体这些API我也没有使用过。不过如果你是要做安装程序,你可以参考Inno Setup,开源的。
    http://www.jrsoftware.org/isdl.php
      

  14.   

    FileWrite(otherfile,myfile,mysize); 第2个参数应该是写入的具体内容,不能用file句柄来代替
    你应该先用FileRead将myfile中的内容读出来再写入otherfile,一步也不能省
      

  15.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      iFileHandle,OFileHandle: Int64;
      iFileLength: int64;
      iBytesRead: int64;
      Buffer: PChar;
      files:PChar;
      i: Integer;
      ReadCount:int64;
    begin
      iFileHandle:=fileopen('D:\test\Nokia_PC_Suite_682_rel_27_0_chi_sc_web.exe',fmopenreadwrite or fmShareDenyNone);
      iFileLength := FileSeek(iFileHandle,0,2);
      FileSeek(iFileHandle,0,0);
      Buffer := PChar(AllocMem(iFileLength + 1));
      iBytesRead := FileRead(iFileHandle, Buffer^, iFileLength);
      ReadCount:=FileRead(iFileHandle,files^,iFileLength);
      showmessage(inttostr(ReadCount));
      Ofilehandle:=fileopen('d:\test\HA_wg0a4_xepin.exe',fmOpenreadwrite or fmsharedenynone);
     // FileSeek(iFileHandle,0,1);
      fileseek(Ofilehandle,0,0);
      filewrite(Ofilehandle,files,iFileLength);
      FileClose(iFileHandle);
      fileclose(Ofilehandle);
      showmessage(inttostr(ibytesread));end;你好
    我这样写还是出问题...
    showmessage(inttostr(ReadCount));显示的是-1
    而且也没有写入正确的东西到otherfile.能帮我调试下发正确的出来吗?
      

  16.   

    var
      iFileHandle,OFileHandle: Int64;
      iFileLength: int64;
      iBytesRead: int64;
      Buffer: PChar;
    begin
      iFileHandle:=fileopen('C:\LANG4-01.wav',fmOpenRead);
      iFileLength := FileSeek(iFileHandle,0,2);
      FileSeek(iFileHandle,0,0);
      Buffer := AllocMem(iFileLength);
      iBytesRead := FileRead(iFileHandle, Buffer^, iFileLength);
      FileClose(iFileHandle);
      showmessage(inttostr(iBytesRead));  Ofilehandle:=FileCreate('c:\LANG4-01.tmp',fmCreate);
      ibytesread:=filewrite(Ofilehandle,Buffer^,iFileLength);
      fileclose(Ofilehandle);
      showmessage(inttostr(ibytesread));
    end;
      

  17.   

    好像流是Delphi特有的,Api没有.
      

  18.   

    去Classes.pas里看TFileStream、THandleStream的源代码
    主要用到的也就是FileCreate
    FileClose
    FileOpen
    FileRead
    FileWrite
    FileSeek
    SetEndOfFile代码并不复杂