-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocessor.c
More file actions
44 lines (34 loc) · 923 Bytes
/
Copy pathprocessor.c
File metadata and controls
44 lines (34 loc) · 923 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
42
43
#include <stdio.h>
int main(int argc, char* argv[]) {
const char* inFileName = 0;
const char* outFileName = 0;
FILE* inFile = 0;
FILE* outFile = 0;
int ch;
#ifdef PROCESSOR_VERSION
fprintf(stderr, "This is: %s\n", PROCESSOR_VERSION);
#endif
if (argc != 3) {
fprintf(stderr, "Usage: %s <input> <output>\n", argv[0]);
return 1;
}
inFileName = argv[1];
outFileName = argv[2];
inFile = fopen(inFileName, "r");
outFile = fopen(outFileName, "w");
if (!inFile) {
fprintf(stderr, "Cannot open input file: \"%s\"\n", inFileName);
return 1;
}
if (!outFile) {
fprintf(stderr, "Cannot open input file: \"%s\"\n", outFileName);
return 1;
}
while ((ch = fgetc(inFile)) != EOF) {
fprintf(outFile, "%02X", ch);
if (ch == '\n') {
fprintf(outFile, "\n");
}
}
return 0;
}