Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
decode16.c
Package: decode16.rar [view]
Upload User: protel
Upload Date: 2021-02-26
Package Size: 1k
Code Size: 3k
Category:
Compress-Decompress algrithms
Development Platform:
C/C++
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- char dic[40000][29];
- int count=255+4096;
- int main(void)
- {
- char s[40000],entry[40000],buf[40000];
- char e[1],se[1],bf[3];
- char a,b,c,d;
- int i,j,k,n,m,sum,total;
- int rf,fcout=0,en=0,slen=0;
- for(n=0;n<=count;n++) {
- dic[n][0]=(char)n;
- //printf("dic[%d][0]=%sn",n,dic[n]);
- }
- FILE *fp,*fw;
- fp=fopen("encode16.txt","r");
- //fp=fopen("test.txt","r");
- //fw=fopen("decode.txt","w");
- fw=fopen("decode2.txt","w");
- if (fp==NULL) {
- printf("open file error!n");
- }
- if (fw==NULL) {
- printf("file not write!n");
- }
- while (fscanf(fp,"%c%c%c%c",&a,&b,&c,&d)!=EOF){
- sum=hex(a,b,c,d);
- //printf("sum=%dn",sum);
- k=find(sum);
- //printf("k=%dn",k);
- strcpy(entry,dic[k]);
- if(k==0){ //not find,entry==NULL
- strcpy(buf,s);
- slen=strlen(buf);
- buf[slen++]=s[0];
- //printf("buf*=%sn",buf);
- strcpy(entry,buf);
- for(i=0;i<=strlen(buf)+29;i++) {
- buf[i]='';
- }
- }
- printf("%s",entry); //out entry
- fprintf(fw,"%s",entry);
- if(s[0]!=''){ //if(s!=NULL)
- strcpy(buf,s);
- slen=strlen(buf);
- buf[slen++]=entry[0];
- //printf("buf=%sn",buf);
- strcpy(dic[++count],buf);
- total+=1;
- for(j=0;j<=strlen(buf)+29;j++) {
- buf[j]='';
- }
- //printf("add dic[%d]=%sn",count,dic[count]);
- }
- strcpy(s,entry); //s=entry
- //printf("s=%sn",s);
- for(m=0;m<=strlen(entry);m++){
- entry[m]='';
- }
- for(rf=0;rf<=2;rf++){
- bf[rf]='';
- }
- e[0]='';
- se[0]='';
- }
- fclose(fp);
- fclose(fw);
- printf("ntotal=%dn",total);
- system("pause");
- return 0;
- }
- hex(int w,int x,int y,int z)
- {
- int al;
- if (w>=48 && w<=57) {
- w=(w-48)* pow(16,3);
- }
- if (w>=97 && w<=102) {
- w=(w-87)* pow(16,3);
- }
- // f=(int)b;
- if (x>=48 && x<=57) {
- x=(x-48)*pow(16,2);
- }
- if (x>=97 && x<=102) {
- x=(x-87)*pow(16,2);
- }
- // g=(int)c;
- if (y>=48 && y<=57) {
- y=(y-48)*pow(16,1);
- }
- if (y>=97 && y<=102) {
- y=(y-87)*pow(16,1);
- }
- // h=(int)d;
- if (z>=48 && z<=57) {
- z=(z-48)*pow(16,0);
- }
- if (z>=97 && z<=102) {
- z=(z-87)*pow(16,0);
- }
- al=w+x+y+z;
- return al;
- }
- find(int *sm)
- {
- int x=0;
- if(sm<=count){
- x=sm;
- }
- return x;
- }