#include <bits/stdc++.h>
using namespace std;
int main()
{
char s1[]="";
char s2[]="abcdefg";
char s3[]="ABCDE";
strncat(s1,s2,);
cout<<s1<<endl;///输出12345abc
strncpy(s1,s3,);
cout<<s1<<endl;///输出ABC45abc
strncpy(s2,s3,);
cout<<s2<<endl;///输出ABCDE
cout<<strncmp(s1,s3,)<<endl;///输出0
char *p=strchr(s1,'B');
if(p)
cout<<p-s1<<","<<*p<<endl;///输出1,B
else
cout<<"Not Found"<<endl;
p=strstr(s1,"45a");
if(p)
cout<<p-s1<<","<<p<<endl;///输出3,45abc
else
cout<<"Not Found"<<endl;
cout<<"strtok usage demo:"<<endl;
char str[]="- This,a sample string,ok.";
p=strtok(str," ,.-");
while(p!=NULL)
{
cout<<p<<endl;
////////////输出
/*
This
a
sample
string
ok */
p=strtok(NULL," ,.-");
}
return ;
}