1. 程式人生 > >c語言char* 轉char[]方法

c語言char* 轉char[]方法

vector<char *> splite_by_delim(char* host_name){
char a[1000];
strcpy(a,host_name);
char *p = strtok(a , split);
vector<char *> segments;
while(p!=NULL) { 
segments.insert(segments.begin(),p); 
p = strtok(NULL,split); 

return segments;
}