GetAppPath 这是怎么回事?

来源:百度知道 编辑:UC知道 时间:2024/06/16 20:48:25
CString m_sFilepath=GetAppPath();
//得到应用程序的路径
m_sFilepath ="\\num.txt";
CFile m_File;
CFileFind m_findfile;
if(m_findfile.FindFile(m_sFilepath)==FALSE)
{//如果没有找到该文件,则创建并写入一定的内容
m_File.Open(m_sFilepath,CFile::modeCreate|CFile::modeWrite);
CString aa="你想跟我斗,早着呢!";
aa =0x0d;
aa =0x0a;//分别为换行和回车
aa ="让你尝尝我的厉害";
aa =0x0d;
aa =0x0a;
m_File.Write(str,str.GetLength());
m_File.Close();
}

d:\李铁健\tel\teldlg.cpp(787): error C3861: “GetAppPath”: 即使使用参数相关的查找,也未找到标识符

GetAppPath();
.NET Framework
Supported in: 2.0, 1.1, 1.0
用下面的函数替换吧
string getAppPath()
{
TCHAR tmp[256];
DWORD ret = ::GetModuleFileName(NULL, tmp, 256);
string buf = tmp;
size_t pos = buf.rfind("\\");
if (pos != (size_t) -1)
{
return buf.substr(0,pos+1);
}
return "";
}