小编Avi*_*esh的帖子

如何在Android中捕获数据包?

我想捕获TCP数据包以及Android中的HTTP和HTTPS等协议数据,类似于Windows中的Wireshark.

我怎样才能在Android中执行此操作?

android packet-capture

21
推荐指数
1
解决办法
11万
查看次数

在字符串中间插入'\ 0'无效(C++)

我有一个字符串并尝试在第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)

c++ string

-2
推荐指数
1
解决办法
529
查看次数

标签 统计

android ×1

c++ ×1

packet-capture ×1

string ×1