我想捕获TCP数据包以及Android中的HTTP和HTTPS等协议数据,类似于Windows中的Wireshark.
我怎样才能在Android中执行此操作?
我有一个字符串并尝试在第k个位置插入'\ 0'(其中k <n&n是字符串的长度).在第3个位置插入'\ 0'并尝试显示字符串.我得到整个字符串,但我只期望'\ 0'之前的部分?我对吗 ?或者c ++字符串有什么特别之处吗?
比如说:
// My string is as below
string s = "wabcdddeefff";
// After inserting '\0' in the 3rd position and tried displaying the string showed the entire string unchanged.
// Will the string now become s = "wab" ??
Run Code Online (Sandbox Code Playgroud)
更清楚.我发布了我的代码.
string s="wwwwaaadexxxxxx";
int l = s.size();
int k = 1;
char a = s[0];
int count = 1;
for(int i=1; i<l; i++) {
if(s[i] == a) {
count++; // cout << "\nS["<<i<<"] " …Run Code Online (Sandbox Code Playgroud)