]>
Commit | Line | Data |
---|---|---|
8ec032fc MW |
1 | |
2 | #include <stdio.h> | |
3 | ||
4 | /** | |
5 | * convert standard input to SQL hex binary | |
6 | */ | |
7 | int main(int argc, char *argv[]) | |
8 | { | |
5848e473 | 9 | int end = 0; |
8ec032fc MW |
10 | unsigned char byte; |
11 | ||
12 | printf("X'"); | |
13 | while (1) | |
14 | { | |
15 | if (fread(&byte, 1, 1, stdin) != 1) | |
16 | { | |
17 | end = 1; | |
18 | break; | |
19 | } | |
20 | printf("%02x", (unsigned int)byte); | |
21 | } | |
22 | printf("'\n"); | |
23 | return 0; | |
24 | } | |
25 |