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. load file in buffer

load file in buffer

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
5 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.
  • B Offline
    B Offline
    Brakanjan
    wrote on last edited by
    #1

    hi I'm new to C++ and would like to know how to load a file into a buffer. Is it something like char *buf1 = fopen(??); though that does not seem to work thanks

    J 1 Reply Last reply
    0
    • B Brakanjan

      hi I'm new to C++ and would like to know how to load a file into a buffer. Is it something like char *buf1 = fopen(??); though that does not seem to work thanks

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      FILE * pf; pf = fopen("C:\\File\\Path\\File.extension" , "R" ); if (pf) { // File well opened // in order to read work on the fread function } if u want to use MFC see the CStdioFile or CFile class Papa Murex Co. while (TRUE) Papa.WillLove ( Bebe ) ;

      B 2 Replies Last reply
      0
      • J jmkhael

        FILE * pf; pf = fopen("C:\\File\\Path\\File.extension" , "R" ); if (pf) { // File well opened // in order to read work on the fread function } if u want to use MFC see the CStdioFile or CFile class Papa Murex Co. while (TRUE) Papa.WillLove ( Bebe ) ;

        B Offline
        B Offline
        Brakanjan
        wrote on last edited by
        #3

        tx for the reply. pf (file in my case) unfortunately does change, but to 0, so the if function isn't entered. The file does exist, cuase I'm using the following code: FILE *file; CFileDialog cf(TRUE); //Get Filename if (cf.DoModal() == IDOK) { CString m_pathname1 = cf.GetPathName(); file=fopen(m_pathname1,"R"); } if (file) { //does not enter here!! } what am I doing wrong?

        1 Reply Last reply
        0
        • J jmkhael

          FILE * pf; pf = fopen("C:\\File\\Path\\File.extension" , "R" ); if (pf) { // File well opened // in order to read work on the fread function } if u want to use MFC see the CStdioFile or CFile class Papa Murex Co. while (TRUE) Papa.WillLove ( Bebe ) ;

          B Offline
          B Offline
          Brakanjan
          wrote on last edited by
          #4

          tx for the reply pf (file in my case) unfortunately does change, but to 0, so the if function isn't entered. The file does exist, cuase I'm using the following code: FILE *file; CFileDialog cf(TRUE); //Get Filename if (cf.DoModal() == IDOK) { CString m_pathname1 = cf.GetPathName(); file=fopen(m_pathname1,"R"); } if (file) { //does not enter here!! } what am I doing wrong?

          P 1 Reply Last reply
          0
          • B Brakanjan

            tx for the reply pf (file in my case) unfortunately does change, but to 0, so the if function isn't entered. The file does exist, cuase I'm using the following code: FILE *file; CFileDialog cf(TRUE); //Get Filename if (cf.DoModal() == IDOK) { CString m_pathname1 = cf.GetPathName(); file=fopen(m_pathname1,"R"); } if (file) { //does not enter here!! } what am I doing wrong?

            P Offline
            P Offline
            pepe 0
            wrote on last edited by
            #5

            file=fopen(m_pathname1,"r"); with a lowercase 'r' "640K ought to be enough for anybody." Bill Gates

            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