当前位置:网站首页>Introduction to libmagic
Introduction to libmagic
2022-06-26 10:12:00 【Ruo_ Xiao】
libmagic Is a development library used to identify file types based on file headers .
chestnuts
#include <magic.h>
#include <stdio.h>
int main(int argc, char **argv) {
struct magic_set *cookie = NULL;
cookie = magic_open(MAGIC_MIME);
magic_load(cookie, NULL);
puts(magic_file(cookie, argv[1]));
magic_close(cookie);
return 0;
}
compile
sudo apt install libmagic-dev
gcc -o main main.c -lmagic
function
./main ~/ desktop /LibreOfficeDraw
result
application/vnd.oasis.opendocument.graphics; charset=binary
(SAW:Game Over!)
边栏推荐
- Redis notes (12) - single thread architecture (non blocking IO, multiplexing) and multiple asynchronous threads
- A concise tutorial for getting started with go generics
- Internationalization configuration
- Detailed explanation of the network security competition questions (2) of the 2021 national vocational college skills competition (secondary vocational group)
- How to find and install the dependent libraries of Debian system
- P1296 whispers of cows (quick row + binary search)
- Cloud native essay using Hana expression database service on Google kubernetes cluster
- What is the web SSH service port of wgcloud
- 全渠道、多场景、跨平台,App如何借助数据分析渠道流量
- The first batch of 12 enterprises settled in! Opening of the first time-honored product counter in Guangzhou
猜你喜欢

做测试需要知道的内容——url、弱网、接口、自动化、

The basis of C language grammar -- learning of local variables and storage categories, global variables and storage categories, and macro definitions

如何更改微信小程序二维码物料颜色

首批12家企业入驻!广州首个集中展销老字号产品专柜开张

Basic grammar of C language -- pointer (character, one-dimensional array) learning

【LeetCode】59. 螺旋矩阵 II

118. 杨辉三角

DAY 3 数组,前置后置,字符空间,关键词和地址指针

Appium automation test foundation - mobile end test environment construction (II)

The IE mode tab of Microsoft edge browser is stuck, which has been fixed by rolling back the update
随机推荐
Daily-used English phrases
c语言语法基础之——函数定义学习
thymeleaf中抽取公共片段
online trajectory generation
方法区里面有什么——class文件、class文件常量池、运行时常量池
From TF 1 X to TF 2.6 (update if you encounter it)
测试实践——app 测试注意点
Redis notes (14) - persistence and data recovery (data persistence RDB and AOF, data recovery, mixed persistence)
调用api接口生成不同颜色的微信小程序二维码
exec系列函数(execl、execlp、execle、execv、execvp)使用
118. 杨辉三角
【无标题】
Leetcode intermediate node of linked list
Threadmode interpretation of eventbus
Allocation de mémoire tas lors de la création d'objets
Logical English structure [key points]
爬虫相关文章收藏:pyppeteer 、Burpsuite
LeetCode 0710. Random numbers in the blacklist - preprocessing implementation o (1) value
软件测试---如何选择合适的正交表
Full introduction to flexboxlayout (Google official flexible implementation of flow layout control)