G
Guest
I am switching from VS2003 .NET to VS2005 and I receive the following
errorwhen compiling my project:
error C3821: 'File': managed type or function cannot be used in an unmanaged
function c:\...\DataBase.cpp
I looked at the knowledgebase:
http://msdn2.microsoft.com/en-us/library/4756a450.aspx and tried to fix the
problem from there but with little success.
Can anyone make a suggestion how to overcom this problem?
File: Database.cpp
int CSendDoc:bOpenIMDOFile (String * File)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
int nDotPos;
CString sTextFileName;
CString sIMDOFileName;
char * st,st2[100];
int l,x;
int DbCt;
CFileStatus status;
CFile * pScript;
CString FileName;
---> FileName = File;
// open the script file specified by the user
if (!CFile::GetStatus(FileName, status))
{
return 0;
}
try
{
pScript = new CFile(FileName,CFile::modeRead | CFile::shareDenyWrite);
}
catch( CFileException* e )
{
CString sError = "IMDO to text file input file: " + sIMDOFileName;
GetErrorText (sError, e->m_lOsError);
e->Delete();
//return SCRIPT_FILE_OPEN_FAILED;
}
CArchive ar(pScript,CArchive::load);
// read in the script file contents
ASSERT( DatabaseIMDOList.IsSerializable() );
DatabaseIMDOList.Serialize(ar);
ar.Close();
delete pScript;
if(!DatabaseIMDOList.IsEmpty())
{
DbCt = DatabaseIMDOList.GetCount();
DbPos = DatabaseIMDOList.GetHeadPosition();
}
else
DbCt = 0;
return DbCt;
}
errorwhen compiling my project:
error C3821: 'File': managed type or function cannot be used in an unmanaged
function c:\...\DataBase.cpp
I looked at the knowledgebase:
http://msdn2.microsoft.com/en-us/library/4756a450.aspx and tried to fix the
problem from there but with little success.
Can anyone make a suggestion how to overcom this problem?
File: Database.cpp
int CSendDoc:bOpenIMDOFile (String * File)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
int nDotPos;
CString sTextFileName;
CString sIMDOFileName;
char * st,st2[100];
int l,x;
int DbCt;
CFileStatus status;
CFile * pScript;
CString FileName;
---> FileName = File;
// open the script file specified by the user
if (!CFile::GetStatus(FileName, status))
{
return 0;
}
try
{
pScript = new CFile(FileName,CFile::modeRead | CFile::shareDenyWrite);
}
catch( CFileException* e )
{
CString sError = "IMDO to text file input file: " + sIMDOFileName;
GetErrorText (sError, e->m_lOsError);
e->Delete();
//return SCRIPT_FILE_OPEN_FAILED;
}
CArchive ar(pScript,CArchive::load);
// read in the script file contents
ASSERT( DatabaseIMDOList.IsSerializable() );
DatabaseIMDOList.Serialize(ar);
ar.Close();
delete pScript;
if(!DatabaseIMDOList.IsEmpty())
{
DbCt = DatabaseIMDOList.GetCount();
DbPos = DatabaseIMDOList.GetHeadPosition();
}
else
DbCt = 0;
return DbCt;
}