format not a string literal and no format arguments
我在 Linux 上编译它时收到警告。snprintf显示const char*
第三个参数。定义 const char *INTERFACE = "wlan0"
然后将其传递给函数有什么问题?
#include <stdio.h>
#include <net/if.h>
#include <string.h>
int main(int argc,char *argv[]){
const char *INTERFACE = "wlan0";
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), INTERFACE);
return 0;
}