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. FileOpen Problem

FileOpen Problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorialannouncement
4 Posts 4 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.
  • A Offline
    A Offline
    Aint
    wrote on last edited by
    #1

    Hello. Im trying to open a file to read some data using VC6 MFC. The problem is that I dont know how to go about after getting the pathname. void CMyExtractDataDlg::OnFileOpen() { // TODO: Add your control notification handler code here /////////////////////// // MY CODE STARTS HERE /////////////////////// CFileDialog m_ldFile(TRUE); // Show the File open dialog and capture the result if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); // Update the dialog UpdateData(FALSE); } /////////////////////// // MY CODE ENDS HERE /////////////////////// } Should I get the filename as well or is pathname alone sufficient? How do i go from here? Thanks in advance.

    R S S 3 Replies Last reply
    0
    • A Aint

      Hello. Im trying to open a file to read some data using VC6 MFC. The problem is that I dont know how to go about after getting the pathname. void CMyExtractDataDlg::OnFileOpen() { // TODO: Add your control notification handler code here /////////////////////// // MY CODE STARTS HERE /////////////////////// CFileDialog m_ldFile(TRUE); // Show the File open dialog and capture the result if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); // Update the dialog UpdateData(FALSE); } /////////////////////// // MY CODE ENDS HERE /////////////////////// } Should I get the filename as well or is pathname alone sufficient? How do i go from here? Thanks in advance.

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      It's good programming practice to always use fully qualified filespecs, i.e. use GetPathName(). /ravi

      This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

      1 Reply Last reply
      0
      • A Aint

        Hello. Im trying to open a file to read some data using VC6 MFC. The problem is that I dont know how to go about after getting the pathname. void CMyExtractDataDlg::OnFileOpen() { // TODO: Add your control notification handler code here /////////////////////// // MY CODE STARTS HERE /////////////////////// CFileDialog m_ldFile(TRUE); // Show the File open dialog and capture the result if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); // Update the dialog UpdateData(FALSE); } /////////////////////// // MY CODE ENDS HERE /////////////////////// } Should I get the filename as well or is pathname alone sufficient? How do i go from here? Thanks in advance.

        S Offline
        S Offline
        Sumesh V V
        wrote on last edited by
        #3

        Use can use CStdioFile for file operations

        Known is a drop, unknown is an ocean

        1 Reply Last reply
        0
        • A Aint

          Hello. Im trying to open a file to read some data using VC6 MFC. The problem is that I dont know how to go about after getting the pathname. void CMyExtractDataDlg::OnFileOpen() { // TODO: Add your control notification handler code here /////////////////////// // MY CODE STARTS HERE /////////////////////// CFileDialog m_ldFile(TRUE); // Show the File open dialog and capture the result if (m_ldFile.DoModal() == IDOK) { // Get the pathname selected m_filePath = m_ldFile.GetPathName(); // Update the dialog UpdateData(FALSE); } /////////////////////// // MY CODE ENDS HERE /////////////////////// } Should I get the filename as well or is pathname alone sufficient? How do i go from here? Thanks in advance.

          S Offline
          S Offline
          Sameer_Thakur
          wrote on last edited by
          #4

          ReturnRain wrote:

          The problem is that I dont know how to go about after getting the pathname.

          Once you have a file name then call yout Application class's OpenDocumentFile(m_filePath); i.e. theApp.OpenDocumentFile(m_filePath); I think this will serve the purpose.

          Sameer Thakur

          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