快讯

在BMP文件中隐藏信息

2004-02-14 09:34  出处:PConline  作者:网上收集  责任编辑:zwg 

/***************************** HEAP MANAGEMENT ***********************/ int initialiseHeap(HEAP* heap) { heap- >dataspace=NULL; heap- >heapunits=0; heap- >nextchar=NULL; heap- >heaplen=0; heap- >dataspace=(unsigned char*)calloc(HEAP_INITUNITS,HEAP_UNITSIZE*sizeof(unsigned char)); if (heap- >dataspace==NULL) return FALSE; else { heap- >heapunits=HEAP_INITUNITS; heap- >nextchar=heap- >dataspace; return TRUE; } } int expandHeap(int newunits, HEAP* heap) { if (newunits >heap- >heapunits) { unsigned char* tmpheap; int i; tmpheap=heap- >dataspace; heap- >dataspace=(unsigned char*)calloc(newunits,HEAP_UNITSIZE*sizeof(unsigned char)); if (heap- >dataspace==NULL) { heap- >dataspace=tmpheap; return FALSE; } else { for (i=0; i< heap- >heapunits*HEAP_UNITSIZE; i++) heap- >dataspace[i]=tmpheap[i]; free(tmpheap); heap- >nextchar=(heap- >dataspace)+(heap- >heapunits*HEAP_UNITSIZE); heap- >heapunits=newunits; } } return TRUE; } void removeHeap(HEAP* heap) { if (heap- >dataspace!=NULL) { free (heap- >dataspace); heap- >heapunits=0; heap- >dataspace=NULL; heap- >nextchar=NULL; heap- >heaplen=0; } } int streamFileToHeap(FILE* infile, HEAP* heap) { unsigned char readchar; while (fscanf(infile,"%c",&readchar) >0) { if (!putToHeap(readchar,heap)) return FALSE; } return TRUE; } int putToHeap(unsigned char data, HEAP* heap) { unsigned long hopeful_pos=heap- >heaplen; unsigned long current_pos=(heap- >heapunits*HEAP_UNITSIZE); if (hopeful_pos >= current_pos) { int discrep=(int)hopeful_pos/HEAP_UNITSIZE; discrep++; if (!expandHeap(discrep, heap)) { return FALSE; } } *(heap- >nextchar)=data; heap- >heaplen++; heap- >nextchar++; return TRUE; }
键盘也能翻页,试试“← →”键
IT热词搜索 来源:360新闻
相关文章

相关软件:

腾讯QQ2012
大小:52.93 MB 授权:免费
腾讯QQ2012
立即下载
腾讯QQ2013
大小:49.32 MB 授权:免费
腾讯QQ2013
立即下载