【发布时间】:2013-08-14 06:43:30
【问题描述】:
strcpy() 中的异常;
void recid(string str,int *begin, int *end)
{
char *f,*str2;
const char c1[2]=":",c2[2]="-";
strcpy(str2,str.c_str());
f=strtok(str2,c1);
f=strtok(NULL,c2);
*begin=atoi(f);
f=strtok(NULL,c2);
*end=atoi(f);
}
你能帮我解决吗?
【问题讨论】:
-
什么异常?你的意思是段错误?另外,为什么在 C++ 中使用 C 字符串函数?如果您不知道自己在做什么以及为什么,那通常是个坏主意。还有一个问题是,str2 是未初始化的指针。
-
你的问题是抛出不显示异常的异常...