C++截取字符串子串实现

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
int substr(char *str,unsigned start, unsigned len)
{
    string temp;
    for(unsigned curr=start;curr<start+len;curr++){
        char tmp=str[curr];
        temp+=tmp;
    }
    cout<<temp<<endl;
   return 0;
}
int main(){
    char *test="wewesdsfadfdss";
    substr(test,3,3);
    return 0;
}