Update sk1/compressor.c
This commit is contained in:
		
							parent
							
								
									528460938a
								
							
						
					
					
						commit
						58666172f4
					
				| @ -225,6 +225,26 @@ int compress_1(const char* input_file_name, const char* output_file_name) { | ||||
| 
 | ||||
| // Функція для декомпресії за допомогою Хаффмана
 | ||||
| int decompress_1(const char* input_file_name, const char* output_file_name) { | ||||
|     // Декомпресія за допомогою Хаффмана потребує відновлення дерева та розшифровки бітових кодів
 | ||||
|     return 0;  // Не реалізовано повністю
 | ||||
|     FILE* input = fopen(input_file_name, "rb"); | ||||
|     if (!input) return -1; | ||||
| 
 | ||||
|     // Načítanie kódovacej tabuľky a ďalších informácií
 | ||||
|     // (toto bude závisieť od vašej implementácie, kde ukladáte tieto informácie)
 | ||||
|     HuffmanTree* tree = load_huffman_tree(input); | ||||
|     if (!tree) return -1; | ||||
| 
 | ||||
|     FILE* output = fopen(output_file_name, "wb"); | ||||
|     if (!output) { | ||||
|         fclose(input); | ||||
|         return -1; | ||||
|     } | ||||
| 
 | ||||
|     // Dekódovanie dát a zapisovanie do výstupného súboru
 | ||||
|     decode_huffman(input, output, tree); | ||||
| 
 | ||||
|     fclose(input); | ||||
|     fclose(output); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user