Mercurial > hg > Members > nobuyasu > CbC
comparison Huffman/test-huffman.c @ 14:43cfb6cbf809 draft
add Huffman
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 31 Jul 2012 04:15:35 +0900 |
parents | |
children | 2ec14e6d8303 |
comparison
equal
deleted
inserted
replaced
13:f29ec9081099 | 14:43cfb6cbf809 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 #define BUF 1024 | |
9 | |
10 | |
11 int main(int argc, char* argv[]) { | |
12 | |
13 FILE *fp; | |
14 char *filename = "./test.txt"; | |
15 if ( (fp = fopen( filename,"r")) == NULL ) { | |
16 fprintf(stderr, "can't open file %s\n", filename); | |
17 exit(0); | |
18 } | |
19 char c; | |
20 while (c = getc(fp)) { | |
21 if (feof(fp)) { | |
22 break; | |
23 } | |
24 | |
25 putc(c,stdout); | |
26 | |
27 } | |
28 | |
29 | |
30 | |
31 | |
32 fclose(fp); | |
33 return 0; | |
34 } |