Results 1 to 2 of 2

Thread: stdio vs fstream - C++

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    stdio vs fstream - C++

    Is there a reason I should use functions from the fstream header rather than just using fputs from stdio if all I want to do is input a string to a text file depending on what button a user presses? There is no user supplied input so I don't need to worry security vulnerabilities or anything. All using fstream seems to do is make my exe so much bigger when all I want to do is something simple. So is it ok to use this simple function? I'm only asking because I have heard to steer clear of certain things because they have inherent problems.
    Last edited by Chazwazza; Sep 26th, 2006 at 06:20 AM.

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: stdio vs fstream - C++

    Quote Originally Posted by Chazwazza
    Is there a reason I should use functions from the fstream header rather than just using fputs from stdio if all I want to do is input a string to a text file depending on what button a user presses? There is no user supplied input so I don't need to worry security vulnerabilities or anything. All using fstream seems to do is make my exe so much bigger when all I want to do is something simple. So is it ok to use this simple function? I'm only asking because I have heard to steer clear of certain things because they have inherent problems.
    So fstream is bloating your exe from 40 or 50 kb to 100 kb? Not a big jump considering the advantages of the standard library. fputs is old C code but fstream and the standard library is C++. I would say everything in the standard library is more robust, safe, and easier to use than anything C.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width