#include #include #include // Read in strings from file // // This reads in huffman codes that have been generated using // // ~mackay/bin/huffman.p informativeoutput=0 lengthonly=1 < probs > symbolcode // (a few header lines have to be deleted from the output file first) int read_it_and_allocate(FILE *,char **,char **, int ); int main( int argc , char *argv[] ){ char **s , **t ; int N = 1024 , Nread ; // maximum number of strings to read FILE *fp ; // create memory for the pointers to the strings s = (char **) malloc( (unsigned) N*sizeof(char *) ) ; t = (char **) malloc( (unsigned) N*sizeof(char *) ) ; fp = fopen( "/home/mackay/compress/octave/symbolcode" , "r" ) ; if(fp) { Nread = read_it_and_allocate( fp , s , t , N ) ; } fclose(fp); return(0); } int read_it_and_allocate( FILE *fp , char **s , char **t , int N ) { char st[800] ; // temporary storage string int ls, lt,i; for(i=0;i