a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

首頁 > 編程 > Delphi > 正文

一個(gè)C++及Delphi做的壓縮程序

2024-07-21 02:28:02
字體:
供稿:網(wǎng)友
{ this is interface of c++ code.
  c++ source code not included to this archive.
  look readme.txt file for more information. }

#ifndef __coding_h__
#define __coding_h__

#ifndef coding_impex
#define coding_impex __declspec(dllimport)
#endif

class coding_impex avldecode
{
   public:
     ~avldecode();
      avldecode();

      virtual int readbuf            
                  ( void     *buf,   
                    unsigned  maxlen,
                    unsigned &rdlen  
                  ) = 0;             

      int  get(void *buf, unsigned  maxlen);
      int  get(void *buf, unsigned  maxlen, unsigned &rdlen)
      {  return ((int)(rdlen = get(buf, maxlen)) < 0)? rdlen :0 ;
      }

      void reset();

   private:

   ????????? private part not included ???????????????????

};


class coding_impex avlencode
{
   public:
     ~avlencode();
      avlencode();

      virtual int writebuf           
                  ( void     *buf,   
                    unsigned  len    
                  ) = 0;             


      int  put(void *buf, unsigned  n);
      void reset();

   private:
  ?????????? private part not icluded ?????????????

};

#endif //__coding_h__


///encode.pas
{$m 8192,120000,120000}
uses avlcodes;

const bufsize=60000;

var p: pointer;
    f,f1: file;
    s: string;
    buf: pointer;
    num: word;

{$f+}

function writetofile(var buf; n: integer): integer;
var num: word;
begin
blockwrite(f1,buf,n,num);
end;

{$f-}

begin
if not getmemory then
  begin
   writeln('not enough memory in heap to compress file.');
   halt;
  end;
s:=paramstr(1);
setencodeoutbuffer(@writetofile);
assign(f,s);
{$i-}
  if s<>'' then reset(f,1);
{$i+}
if (ioresult<>0) or (s='') then
  begin
   writeln;
   writeln('the author of this turbo pascal program and original c++ code is');
   writeln('alexander larkin   ( translated to turbo pascal from c++ on 27/09/1999 )');
   writeln;
   writeln('e-mail:      [email protected]');
   writeln('internet:    http://www.geocities.com/siliconvalley/6235/tpdl.htm');
   writeln;
   writeln('usage: encode.exe infile outfile [password]');
   writeln;
   freememory;
   halt;
  end;
s:=paramstr(2);
assign(f1,s);
{$i-}
if s<>'' then rewrite(f1,1);
{$i+}
if (ioresult<>0) or (s='') then
  begin
   close(f);
   writeln('cannot create find file '+s);
   freememory;
   halt;
  end;
setpassword(paramstr(3));
  getmem(buf,bufsize);
   repeat
    blockread(f,buf^,bufsize,num);
    encodeput(buf^,num);
   until num<=0;
  if num<0 then writeln('cannot compress file. you do something wrong.');
encodereset;
close(f);
close(f1);
freememory;
end.

///decode.pas
{$m 8192,120000,120000}
uses avlcodes;

const bufsize=60000;

var p: pointer;
    f,f1: file;
    s: string;
    buf: pointer;
    num: word;

{$f+}

function readfromfile(var buf; n: integer; var rdlen: integer): integer;
begin
blockread(f,buf,n,rdlen);
readfromfile:=0;
end;

{$f-}

begin
if not getmemory then
  begin
   writeln('not enough memory in heap to decompress file.');
   halt;
  end;
s:=paramstr(1);
setdecodeinbuffer(@readfromfile);
assign(f,s);
{$i-}
  if s<>'' then reset(f,1);
{$i+}
if (ioresult<>0) or (s='') then
  begin
   writeln;
   writeln('the author of this turbo pascal program and original c++ code is');
   writeln('alexander larkin   ( translated to turbo pascal from c++ on 27/09/1999 )');
   writeln;
   writeln('e-mail:      [email protected]');
   writeln('internet:    http://www.geocities.com/siliconvalley/6235/tpdl.htm');
   writeln;
   writeln('usage: decode.exe infile outfile [password]');
   writeln;
   freememory;
   halt;
  end;
s:=paramstr(2);
assign(f1,s);
{$i-}
if s<>'' then rewrite(f1,1);
{$i+}
if (ioresult<>0) or (s='') then
  begin
   close(f);
   writeln('cannot create file '+s);
   freememory;
   halt;
  end;
  getmem(buf,bufsize);
  setpassword(paramstr(3));
   repeat
    num:=decodeget(buf^,bufsize);
    if num<65535 then blockwrite(f1,buf^,num,num);
   until (num=0) or (num=65535);
if num=65535 then writeln('error! data corrupted. cannot decompress file.');
close(f);
close(f1);
freememory;
end.


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 国产区视频在线观看 | 久久精品久久久 | 日本久久精品视频 | www,久久久 | 久久精品中文 | 免费黄在线看 | 精品国产一区二区三区免费 | 国产精品久久久久久亚洲调教 | 精品国产18久久久久久二百 | 亚洲精品成人a8198a | 欧美日韩精品一区二区三区在线观看 | 国产精品九九九 | 精品国产91亚洲一区二区三区www | 国产一区二区免费视频 | 欧美精品二区 | 亚洲欧美中文日韩v在线观看 | 色婷婷一区| 亚州黄色| 91精品国产综合久久久久久丝袜 | 亚洲一区二区三区在线免费观看 | 国产中文字幕在线 | 国产精品18hdxxxⅹ在线 | 亚洲综合在线一区 | 超碰激情| 一级毛片,一级毛片 | 久久精品视频网站 | 国产欧美一区二区精品婷婷 | 亚洲精品www | 久久91精品久久久久久9鸭 | 麻豆专区一区二区三区四区五区 | 国产伦精品一区二区三区在线 | 日本在线视频一区二区三区 | 国产精品久久 | 亚州成人 | 日日干夜夜干 | 亚洲精品免费在线观看 | 久久久噜噜噜久久久 | 亚洲一区二区视频在线观看 | 精品不卡| 国产一级电影网 | 一区二区日本 |