Thread: defaulting ifstream variable to standard input

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    But remember that you're supposed to switch the buffer back before destructing the stream.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Registered User
    Join Date
    Apr 2006
    Quote Originally Posted by risby View Post
    That looks good. I've tried it and it works fine with stdin but fails to read anything from a file. I'll play around with it though, thanks.
    As I had written it, I had the wrong condition on the if statement. It should be if(inputStream).
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Input class project (again)
    By Elysia in forum C++ Programming
    Replies: 41
    Last Post: 02-13-2009, 10:52 AM
  2. Writing a Variable as a string input to a function
    By gaza2k1 in forum C++ Programming
    Replies: 4
    Last Post: 11-29-2007, 01:04 PM
  3. Outputting to a File Modified Text
    By alpha in forum C++ Programming
    Replies: 8
    Last Post: 11-24-2003, 08:39 PM
  4. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  5. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM