小弟写了一个程序,遇到一个很大的问题请帮忙呢,定义了两个string类型的变量,然后用在程序中出现了这样的问题。第一个string A 定义为全局变量,在第一个函数里面,用于接收API收到的const char *类型的参数。然后,在第二个函数里面,再次定义一个string B,并让B = A;此时程序执行到此处时B的结果出现错误,其返回值的前四位是随机的数然后才是A的值。不仅在赋值上如此,所有的对string类型的赋值方式都会出现四位内存错误,请问这个要怎么解决呢~~~~~~急求
有代码吗?代码贴出来看看呢
enter code herevoid
VideoClips.h
std::string m_strFilePath;
std::string m_strFileOutPath;
std::string m_strIP;
void SetConfig(const char * FilePath , const char * IP ,const char * FileOutPath );
void TakeFile();
VideoClips.cpp
VideoClips:: SetConfig(const char * FilePath , const char * IP ,const char * FileOutPath )
{
m_strFilePath = FilePath;
m_strFileOutPath = FileOutPath;
m_strIP = IP;
}//这里的赋值是对的“D://”
BOOL VideoClips::TakeFile()
{
string strLocalTime = m_strFilePath;
}//这里的赋值就是错的 结果是 “ D://”
"D://" 是从哪里来的? 应该是其他地方的代码有问题,