strstr()函数

头文件:string.h

函数名: strstr()

函数原型:extern char *strstr(const char *str1, const char *str2);

语法:* strstr(str1,str2)

str1: 被查找目标 string expression to search.

str2: 要查找对象 The string expression to find.

返回值:该函数返回str2第一次在str1中的位置,如果没有找到,返回NULL

例如:

charstr[]="abcdxyz";

char*str1=strstr(str,"c");

返回: cdxyz

 

判断是否是网络参数:

LPCTSTR port;

char *pkeyend;

int nport =0;

pkeyend = strstr(port,":");

nport = atoi(port);

 

 

 

你可能感兴趣的:(strstr()函数)