请问它们错在哪里了

smith888898 2008-01-05 09:52:37
AfxCore.cpp文件中,下列二个函数存在问题.


按F10的时候,接收到个股资料无法读出. 如000001的资料,保存的文件名是01.txt,
即也就是只取代码的后2位构成文件名!
CString AfxGetFileTitle( LPCTSTR lpszPathName )
{
CString strPathName = lpszPathName;
if( strPathName.IsEmpty() )
return "";
UINT nTitleLen = AfxGetFileTitle( strPathName, NULL, 0 );
if( nTitleLen <= 0 || nTitleLen-1 > (UINT)strPathName.GetLength() )
return "";

CString strTitle = strPathName.Right( nTitleLen-1 );
return strTitle;
}

CString AfxGetFileTitleNoExt( LPCTSTR lpszPathName )
{
CString strPathName = lpszPathName;
if( strPathName.IsEmpty() )
return "";
UINT nTitleLen = AfxGetFileTitle( strPathName, NULL, 0 );
if( nTitleLen <= 0 || nTitleLen-1 > (UINT)strPathName.GetLength() )
return "";

CString strTitle = strPathName.Right( nTitleLen-1 );
int nIndex = strTitle.ReverseFind( '.' );
if( -1 != nIndex )
strTitle = strTitle.Left( nIndex );
return strTitle;
}
...全文
123 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lori227 2008-01-05
  • 打赏
  • 举报
回复
第一个传入文件路径,获得文件名,第二获得没有后缀的文件名,然后呢?

用AfxGetFileTitle我编译通不过,我改的
UINT nTitleLen = GetFileTitle( strPathName, NULL, 0 );
goodmrning 2008-01-05
  • 打赏
  • 举报
回复
sf
帮楼主顶下!!!!!!!111

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧