[RESOLVED] CFILE::GetStatus failed??Whats wrong?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] CFILE::GetStatus failed??Whats wrong?

  1. #1
    Join Date
    Jul 2013
    Posts
    9

    [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

  2. #2
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,262

    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.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    Jul 2013
    Posts
    9

    Re: CFILE::GetStatus failed??Whats wrong?

    Thanks for the reply ,that was a problem with file extension ..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center