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. File I/O : Which one to use? CFile or fstream?

File I/O : Which one to use? CFile or fstream?

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

    Hello, I am working with VC++ 6.0 (MFC). I need to write the following structure to a file in binary mode. struct EmployeeData { char strName[50]; UINT nAge; float fSalary; }; For that, which class that I will use? CFile or fstream? TIA, Regards, Jahfer V P

    S 1 Reply Last reply
    0
    • J jahfer

      Hello, I am working with VC++ 6.0 (MFC). I need to write the following structure to a file in binary mode. struct EmployeeData { char strName[50]; UINT nAge; float fSalary; }; For that, which class that I will use? CFile or fstream? TIA, Regards, Jahfer V P

      S Offline
      S Offline
      stolid_rock
      wrote on last edited by
      #2

      I suggest you should use the CFile rather than fstream. You can do lots of things using the functionality CFile provides

      J 1 Reply Last reply
      0
      • S stolid_rock

        I suggest you should use the CFile rather than fstream. You can do lots of things using the functionality CFile provides

        J Offline
        J Offline
        jahfer
        wrote on last edited by
        #3

        Dear Stolid_rock, Can you give any sample code doing this? Regards, Jahfer V P.

        S R 2 Replies Last reply
        0
        • J jahfer

          Dear Stolid_rock, Can you give any sample code doing this? Regards, Jahfer V P.

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

          You can get some basic implementations at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/\_core\_files\_in\_mfc.asp and http://www.codersource.net/mfc\_cfile.html

          1 Reply Last reply
          0
          • J jahfer

            Dear Stolid_rock, Can you give any sample code doing this? Regards, Jahfer V P.

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

            See this[^] series of articles. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

            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