Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get an exception while opening a file

Get an exception while opening a file

Scheduled Pinned Locked Moved C / C++ / MFC
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V K 2
    wrote on last edited by
    #1

    Hi , I am using the below code for retrieving the length of a file. I have list of file names in a CStringArray object. bool Search(CString szBinName,CString szBinSize,CStringArray& arr) { int nSize = arr.GetSize(); CString str,temp; bool bRet; bRet = false; for(int i=0;i

    _ M 2 Replies Last reply
    0
    • V V K 2

      Hi , I am using the below code for retrieving the length of a file. I have list of file names in a CStringArray object. bool Search(CString szBinName,CString szBinSize,CStringArray& arr) { int nSize = arr.GetSize(); CString str,temp; bool bRet; bRet = false; for(int i=0;i

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      I believe CFile::shareExclusive|CFile::shareDenyNone don't go together.

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      V 1 Reply Last reply
      0
      • _ _Superman_

        I believe CFile::shareExclusive|CFile::shareDenyNone don't go together.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        V Offline
        V Offline
        V K 2
        wrote on last edited by
        #3

        I have tried putting only one of the CFile::shareExclusive|CFile::shareDenyNone , still it crashes.

        _ 1 Reply Last reply
        0
        • V V K 2

          I have tried putting only one of the CFile::shareExclusive|CFile::shareDenyNone , still it crashes.

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          What does ex.GetErrorMessage() give you?

          «_Superman_» I love work. It gives me something to do between weekends.
          Microsoft MVP (Visual C++)

          V 1 Reply Last reply
          0
          • _ _Superman_

            What does ex.GetErrorMessage() give you?

            «_Superman_» I love work. It gives me something to do between weekends.
            Microsoft MVP (Visual C++)

            V Offline
            V Offline
            V K 2
            wrote on last edited by
            #5

            It gives me the below value for ex.GetErrorMessage ex ={Cause=0 OS Error = m_IOsError}

            1 Reply Last reply
            0
            • V V K 2

              Hi , I am using the below code for retrieving the length of a file. I have list of file names in a CStringArray object. bool Search(CString szBinName,CString szBinSize,CStringArray& arr) { int nSize = arr.GetSize(); CString str,temp; bool bRet; bRet = false; for(int i=0;i

              M Offline
              M Offline
              Michael Schubert
              wrote on last edited by
              #6

              1. Format your code with the "pre" tags. We can't see your complete "for" statement 2. Why are you passing the file size as CString? 3. What is the value of i when it crashes?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups