CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    india/chennai
    Posts
    29

    CFileException not working in ReleaseMinDependecy Mode

    hi
    i have wriitern a windows nt service program. in this im reading a configuration file if the file is not present i will be wriiting the error into windows nt event log.

    this is the code
    if(fFile.Open(szFilePath,CFile::modeCreate|CFile::modeNoTruncate |CFile::modeReadWrite|CFile::shareDenyWrite))
    {
    fFile.SeekToEnd();
    return TRUE;
    }
    else
    {

    CString szError,szLog;
    char strerr[500];
    fileException.GetErrorMessage(strerr,100);
    szError.Format("Couldnt open the file %s please check the path ",szFilePath);
    szLog=szError;
    szLog+=strerr;
    //event log
    CServiceModule::LogEvent(_T(szLog),TPRSERVICE_ERROR,EVENTLOG_ERROR_TYPE);

    }

    the problem is the strerr variable is populated with error in debug mode but not in releasemindependency mode.
    the length of strerr is returned as 0 in release mode and 24 in debug mode. i would like to know cause of this problem and appropriate remedy.
    thanx in advance
    regards
    Aswin.N.Paranji

  2. #2
    Join Date
    Nov 2000
    Location
    Munich, Germany
    Posts
    161
    I can't belive this code is working in debug mode. Add &fileException as third parameter to the Open call and see what's happening.
    The Saviour of the World is a Penguin and Linus Torvalds is his Prophet.

  3. #3
    Join Date
    Jan 2003
    Location
    india/chennai
    Posts
    29

    CFileException not working in ReleaseMinDependecy Mode

    sorry boss,
    that was the old code. well i have actually included the &fileException. i didnt copy that. sorry for that. im still haveing the problem
    regards
    Aswin

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured