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. fileObj.Open

fileObj.Open

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
8 Posts 5 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.
  • P Offline
    P Offline
    p_
    wrote on last edited by
    #1

    hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks

    C H D 3 Replies Last reply
    0
    • P p_

      hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #2

      do you actually want to open the file to write or read something? or are you looking to open the file in notepad automatically.

      P 1 Reply Last reply
      0
      • C chandu004

        do you actually want to open the file to write or read something? or are you looking to open the file in notepad automatically.

        P Offline
        P Offline
        p_
        wrote on last edited by
        #3

        ya i want to open a file

        C 1 Reply Last reply
        0
        • P p_

          ya i want to open a file

          C Offline
          C Offline
          chandu004
          wrote on last edited by
          #4

          to write data into file,use FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");

          D 1 Reply Last reply
          0
          • P p_

            hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            For second section of your question see CFileFind Class . and for first section are you sure you have this file on the correct path?

            1 Reply Last reply
            0
            • P p_

              hi all vc++ masters 1)i use this code on a button CString strpath="C:\\72456\\gg.txt"; CStdioFile fileObj; fileObj.Open(strpath, CFile::modeRead | CFile::shareDenyWrite); but it could not open the gg file please help me 2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it thanks

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              p_ wrote:

              but it could not open the gg file

              Why not? Are you for sure that the file exists? Have you tried to pass a CFileException* when calling Open() method?

              p_ wrote:

              2)i want that when i write a name of file on edit box and click on button it search file in c drive and open it

              If the edit control also contains the file's path, no searching is required. Just use CFile or CStdioFile to open the file.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              1 Reply Last reply
              0
              • C chandu004

                to write data into file,use FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                chandu004 wrote:

                FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");

                :confused::rolleyes::omg::wtf:


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                M 1 Reply Last reply
                0
                • D David Crow

                  chandu004 wrote:

                  FILE * fp; fp=fopen("filename.txt","w"); fprintf("hello"); fclose(fp); to open the file automatically, use system("notepad filename.txt");

                  :confused::rolleyes::omg::wtf:


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  :sigh:

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  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