Following is my string

const char* str = "./a.out(__gxx_personality_v0+0x35d) [0x400e5d]";

我只想得到 "0x400e5d "字符串,即括在[和]括号中的子字符串。

I tried following but could not worked:

 char temp[1024];
 sscanf(symbol, "%*[^[]%1023[^]]", temp);

但它给出了"[0x400e5d "的输出。如何避免输出中的"["?

c++
regex
linux
scanf
BSalunke
BSalunke
发布于 2014-02-07
1 个回答
Jonathan Leffler
Jonathan Leffler
发布于 2014-02-07
已采纳
0 人赞同

Read the [: