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. CFileDialog interferes later used fopen?

CFileDialog interferes later used fopen?

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelptutorialquestion
4 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.
  • J Offline
    J Offline
    Janine
    wrote on last edited by
    #1

    Hi, Is it possible that CFileDialog interferes somehow (for example due to some mistake) later opening of a file using fopen?:confused: I have a setting dialog and its state can be loaded and saved. I'm using CFileDialog to get the file name and path to be saved/opened and serialization for the loading itself. The setting file is opened from the menu. The error occurs if I first either load or save the settings and then try to run one thing in my program. In that "one thing" a file is tried to be opened using fopen but the opening fails. If I remove the CFileDialog from loading and use static file name instead when opening a file using CFile the opening succeedes. Are there some other things that usually interfere fopen? -Janetta

    T A 2 Replies Last reply
    0
    • J Janine

      Hi, Is it possible that CFileDialog interferes somehow (for example due to some mistake) later opening of a file using fopen?:confused: I have a setting dialog and its state can be loaded and saved. I'm using CFileDialog to get the file name and path to be saved/opened and serialization for the loading itself. The setting file is opened from the menu. The error occurs if I first either load or save the settings and then try to run one thing in my program. In that "one thing" a file is tried to be opened using fopen but the opening fails. If I remove the CFileDialog from loading and use static file name instead when opening a file using CFile the opening succeedes. Are there some other things that usually interfere fopen? -Janetta

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Can you check errno variable when fopen fails? This will give you more info on why fopen failed. Tomasz Sowinski -- http://www.shooltz.com

      What is "scratch" and why can everything be made from it?

      1 Reply Last reply
      0
      • J Janine

        Hi, Is it possible that CFileDialog interferes somehow (for example due to some mistake) later opening of a file using fopen?:confused: I have a setting dialog and its state can be loaded and saved. I'm using CFileDialog to get the file name and path to be saved/opened and serialization for the loading itself. The setting file is opened from the menu. The error occurs if I first either load or save the settings and then try to run one thing in my program. In that "one thing" a file is tried to be opened using fopen but the opening fails. If I remove the CFileDialog from loading and use static file name instead when opening a file using CFile the opening succeedes. Are there some other things that usually interfere fopen? -Janetta

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Hi, the CFileDialog changes the current working directory when you select a particular file. Are you using the value of current directory in any way for opening the file? To prevent this change in the current directory, use the OFN_NOCHANGEDIR flag in the member variable m_ofn of CFileDialog. HTH

        J 1 Reply Last reply
        0
        • A Anonymous

          Hi, the CFileDialog changes the current working directory when you select a particular file. Are you using the value of current directory in any way for opening the file? To prevent this change in the current directory, use the OFN_NOCHANGEDIR flag in the member variable m_ofn of CFileDialog. HTH

          J Offline
          J Offline
          Janine
          wrote on last edited by
          #4

          Problem solved. Thanks!:rose: -Janetta

          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