fstream,ifstream,ofstream

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ana butt
    New Member
    • Jul 2015
    • 2

    #1

    fstream,ifstream,ofstream

    i just need to know why ifstream and ofstream are used ??
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    They are part of the C++ Standard Template Library.

    I can't answer this until you understand templates and polymorphism.

    Until then, you use these if you use the standard library. If you use something else, then you can ignore these.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Is your question: "Why would anybody use ifstream or ofstream when they could just use fstream?"

      Comment

      • ana butt
        New Member
        • Jul 2015
        • 2

        #4
        yup . i wanna know the clear concepts of ifstream and ofstream,could uh plz tell me a difference briefly...thank s!

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          ifstream is for input only.
          ofstream is for output only.
          fstream is for input, or output, or input mixed with output.

          fstream is more powerful, but also more complicated to use.

          Comment

          Working...