-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategory_decode.c
More file actions
41 lines (35 loc) · 861 Bytes
/
category_decode.c
File metadata and controls
41 lines (35 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "bitstr.h"
#include "bmp.h"
#include "zigzag.h"
#include "stdefine.h"
#include <stdlib.h>
#include "huffman.h"
#include "color.h"
#include "quant.h"
#include <string.h>
#include "dct.h"
#include <stdio.h>
#include "jfif.c"
#include "jfif.h"
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "Usage: %s <input_file>\n", argv[0]);
return 1;
}
FILE *inputFile = fopen(argv[1], "r");
if (!inputFile) {
fprintf(stderr, "Error opening file: %s\n", argv[1]);
return 1;
}
int code, size;
if (fscanf(inputFile, "%d %d", &code, &size) != 2) {
fprintf(stderr, "Error reading integers from file.\n");
fclose(inputFile);
return 1;
}
fclose(inputFile);
int result = category_decode(code, size);
printf("Result: %d\n", result);
return 0;
}