标签:文件 har main char s ring shell turn lan 代码
代码:
#include <stdio.h>
#include <string.h>
const char *p = " [ session ] ";
int main() {
char *ps1 = NULL;
char *ps2 = NULL;
char s[64] = {0};
ps1 = p + strspn(p, "[ \t");
printf("%s\n", ps1);
ps2 = ps1 + strcspn(ps1, "\t ]");
printf("%s\n", ps2);
strncpy(s, ps1, ps2-ps1);
printf("%s\n", s);
return 0;
}
结果:
session ]
]
session
标签:文件 har main char s ring shell turn lan 代码
原文地址:https://www.cnblogs.com/kansnow/p/12546964.html