[RESOLVED] CFILE::GetStatus failed??Whats wrong?
Hey guys ,
I am trying to open a file from local Path by the follwing code
CString csRegExtractFileRemote;
CFileException ef;
CFileStatus cfsStatus;
CFile cfSAP;
csRegExtractFileRemote = "c:\\SW\\RemoteFile\\sample.txt";
if ( cfSAP.GetStatus(csRegExtractFileRemote, cfsStatus))
{
cout<<"YES\n"<<endl;
// open up the Extract file and create an archive for it
cout<<" Opening Extract file "<<endl;
if( !cfSAP.Open( csRegExtractFileRemote, CFile::modeRead, &ef ) )
{
cout<<"FAILED\n"<<endl;
printf("File %S could not be opened - %S",csRegExtractFileRemote,ef.m_cause);
//cout<<"File '%s' could not be opened - %s", csRegExtractFileRemote, ef.m_cause);
return FALSE;
}
cout<<"SUCCESS\n"<<endl;
CArchive caSAP( &cfSAP, CArchive::load );
CString csNewLine,
csSyncStatus;
int iTotalLines = 0;
cout<<"Done till here"<<endl;
}
Compilation is success full ,but i am observing that some junk value i sthere in the path variable
After Reaching If statment cursor went to final return statment ...
I donknow whats wrong in this Code
Can any one help me to resolve this
Re: CFILE::GetStatus failed??Whats wrong?
1) Please use code tags when posting code. Go Advanced, select the code and click '#'
2) As you are trying to use the static version of GetStatus (without first opening the file), try
Code:
if ( CFile::GetStatus((LPCTSTR)csRegExtractFileRemote, cfsStatus))
Note that GetStatus requires the file name as type LPCTSTR.
Re: CFILE::GetStatus failed??Whats wrong?
Thanks for the reply ,that was a problem with file extension ..