33,311
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <tchar.h>
#include <string.h>
int main() {
TCHAR s[]=_T("abc def=123 456\n");
TCHAR n[256];
TCHAR v[256];
_tprintf(_T("[%s]\n"),s);
if (2==_stscanf(s,_T("%255[^=]=%255[^\n]"),n,v)) {
_tprintf(_T("get value of [%s]: [%s]\n"),n,v);
} else {
_tprintf(_T("Format error:[%s]\n"),s);
}
return 0;
}
//[abc def=123 456
//]
//get value of [abc def]: [123 456]
//