strcasecmp linux

#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
#include <stdio.h>
#define CONFIG_DIR "/etc/usbs/"
int main()
{
  
 
    char  fname[PATH_MAX];
    strcpy(fname,"ABC.txt");
    char filename[40];
    strcpy(filename,"abc.txt");
     if (!strcasecmp(fname, filename)) {
             printf("Hello, World!\n");
        }
  
    return 0;
}

 

strcasecmp用忽略大小写比较字符串.,通过strcasecmp函数可以指定每个字符串用于比较的字符数,strncasecmp用来比较参数s1和s2字符串前n个字符,比较时会自动忽略大小写的差异。strcasecmp函数是二进制且对大小写不敏感。此函数只在Linux中提供,相当于window...

posted on 2021-01-02 00:51  lydstory  阅读(151)  评论(0)    收藏  举报

导航