FrameName 是int类型的,CString Name;
char* PathName;
CString FrameName;
FrameName.Format("%d",FrameNum);Name = "C:\\Color_Ratio\\" ;
strcpy(PathName,Name);
strcat(PathName,FrameName);
strcat(PathName,".bmp");目的是想在C盘下的Color_Ratio文件夹中增加一个文件名为FrameName(转化成字符串了)的位图文件编译是没有报错,但是在调试运行时出现以下错误信息:Unhandled exception at 0x00694539 in VideoCap.exe: 0xC0000005: Access violation writing location 0xcccccccc.什么原因?该怎么处理??
谢谢!!!
char* PathName;
CString FrameName;
FrameName.Format("%d",FrameNum);Name = "C:\\Color_Ratio\\" ;
strcpy(PathName,Name);
strcat(PathName,FrameName);
strcat(PathName,".bmp");目的是想在C盘下的Color_Ratio文件夹中增加一个文件名为FrameName(转化成字符串了)的位图文件编译是没有报错,但是在调试运行时出现以下错误信息:Unhandled exception at 0x00694539 in VideoCap.exe: 0xC0000005: Access violation writing location 0xcccccccc.什么原因?该怎么处理??
谢谢!!!
strcat(PathName,FrameName);
strcat(PathName,".bmp");
->Name=Name+FrameName+".bmp";
int length=str.GetLength()
PathName=new char[length];
PathName=Name.GetBuffer(0);你的问题主要是PathName没有分配内存