标题:请教程序:为什么该程序在VS2005中运行总出现错误?(错误提示粘贴到程序最 ...
取消只看楼主
kxfei5555w
Rank: 1
等 级:新手上路
帖 子:23
专家分:5
注 册:2010-9-27
结帖率:100%
 问题点数:0 回复次数:1 
请教程序:为什么该程序在VS2005中运行总出现错误?(错误提示粘贴到程序最后)
nt _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
    int nRetCode = 0;

    // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
        // TODO: change error code to suit your needs
        _tprintf(_T("Fatal Error: MFC initialization failed\n"));
        nRetCode = 1;
    }
    else
    {
        // TODO: code your application's behavior here.
        CFile file("\\VC教程\\MyFile.txt",CFile::modeReadWrite);
        ULONGLONG m_nLen=file.GetLength();
        char str[80];
        file.Read(&str,m_nLen);
        for(int i=0;i<m_nLen;i++)
            cout<<str[i];
        cout<<endl;
        file.Close();
    }

    return nRetCode;
}
为什么改程序在VS2005中运行总提示如下错误,请各位高手指教。
1>e:\myfile\myfile\myfile.cpp(34) : error C2664: 'CFile::CFile(LPCTSTR,UINT)' : cannot convert parameter 1 from 'const char [19]' to 'LPCTSTR'
搜索更多相关主题的帖子: 运行 提示 
2010-10-02 20:38
kxfei5555w
Rank: 1
等 级:新手上路
帖 子:23
专家分:5
注 册:2010-9-27
得分:0 
回复 2楼 红色警戒
恩 这样就没错误了 但是在运行时还有些问题 我在琢磨下
2010-10-03 11:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-321883-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.103382 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved