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))
// open up the Extract file and create an archive for it
cout<<" Opening Extract file "<<endl;
if( !cfSAP.Open( csRegExtractFileRemote, CFile::modeRead, &ef ) )
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;

CArchive caSAP( &cfSAP, CArchive::load );
CString csNewLine,
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