LZSSTEST.C
上传用户:zhangcx
上传日期:2013-12-13
资源大小:18k
文件大小:1k
源码类别:

压缩解压

开发平台:

C/C++

  1. /*
  2.   EDILZSS.DLL - Test program
  3.   Copyright 1991 Robert Salesas, All Rights Reserved.
  4.   See Pascal example for more information.
  5. */
  6. #include <windows.h>
  7. #include <dos.h>
  8. #include <string.h>
  9. int FAR PASCAL LZSSPackFile(LPSTR SrcFile, LPSTR DstFile);
  10. // Packs SrcFile to DstFile using a LZSS algorithm.
  11. int FAR PASCAL LZSSUnPackFile(LPSTR SrcFile, LPSTR DstFile);
  12. // Unpacks SrcFile to DstFile using a LZSS algorithm.
  13. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
  14.    LPSTR lpszCmdLine, int nCmdShow )
  15. {
  16.   int  cmdCode;
  17.   int  errCode;
  18.   char *srcFile;
  19.   char *dstFile;
  20.   char *p;
  21.   char buf[255];
  22.   lstrcpy((LPSTR)buf, lpszCmdLine);
  23.   p = strtok(buf, " ");
  24.   if (p)
  25.     {
  26.       if (stricmp(p, "e") == 0)
  27. cmdCode = 1;
  28.       else
  29. cmdCode = 0;
  30.       srcFile = strtok(NULL, " ");
  31.       if (srcFile)
  32. {
  33.   dstFile = strtok(NULL, " ");
  34.   if (dstFile)
  35.     {
  36.       if (cmdCode == 1)
  37. errCode = LZSSPackFile(srcFile, dstFile);
  38.       else
  39. errCode = LZSSUnPackFile(srcFile, dstFile);
  40.       if (errCode)
  41. MessageBox(0, "ERROR #--, unable to complete operation.",
  42.    "EDI LZSS TEST", MB_OK | MB_ICONINFORMATION);
  43.       else
  44. MessageBox(0, "All done.",
  45.    "EDI LZSS TEST", MB_OK | MB_ICONEXCLAMATION);
  46.       return 0;
  47.     }
  48. }
  49.     }
  50.   MessageBox(0, "USAGE:  LZSSTEST e|d infile outfile", "EDI LZSS TEST",
  51.      MB_OK | MB_ICONINFORMATION);
  52. }