分类: 嵌入式
2010-05-14 13:08:02
vxWorks提供了缺省的压缩工具inflate,这是一个高速解压的工具。 在windows上实现压缩: D:\Tornado2.2.2ForPpc\host\x86-win32\bin>deflate Deflation: 89.23% 在target上实现解压: void usrTestInflate(char *pFileName) { char *pSrc, *pDst; int iRet = 0; int iLen, fd; fd = open(pFileName, 2, 0); if (fd == -1) { printf("\r\n can't open file"); return; } pSrc = malloc(0x10000); iLen = read(fd, pSrc, 0x10000); pDst = malloc(0x10000); iRet = inflate(pSrc, pDst, iLen); printf("\r\n inflate file %s, from 0x%x to 0x%x, length is 0x%x, result is 0x%x", pFileName, pSrc, pDst, iLen, iRet); } 下面是shell上的输出: -> sp usrTestInflate,"vxbuslog.z" task spawned: id = 0xae8f60, name = t1 value = 11439968 = 0xae8f60 -> inflate file vxbuslog.z, from 0xad4130 to 0xac4120, length is 0x1bb, result is 0x0 |