1 #include <stdio.h>
2 #include <magic.h>
3
- 4 int main(int c, char** v) {
| 5 magic_t myt = magic_open(MAGIC_CONTINUE|MAGIC_ERROR/*|MAGIC_DEBUG*/|MAGIC_MIME);
| 6 magic_load(myt, NULL);
| 7 printf("magic output: '%s'\n", magic_file(myt, v[1]));
| 8 magic_close(myt);
| 9
| 10 return 0;
| 11 }
具体的库参照资源