Thread: output a string to a standard output

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    36

    output a string to a standard output

    vs input a string from a standard input..


    does anyone have any clue as to what that means at all?

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    In C, you have 3 "files" opened by default:

    • stdout
    • stdin
    • stderr


    The "std" in their names means "standard". The first two are for output and input, respectively. The last one is a special one meant for output used to report error messages.

    When you use a function like printf() or puts(), you're writing to the stdout. Similarly, when you use a function like scanf() or fgets(), you're reading from stdin.

    The phrase "output a string to a standard output" seems slightly off balance, as does the other one you mention, but I believe what you're reading is just basically referring to writing and reading strings from the standard streams.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    fgets reads from any stream passed as a 3rd parameter, not only a stdin
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Yeah, that was a bad example.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom String class gives problem with another prog.
    By I BLcK I in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2006, 03:40 AM
  2. can anyone see anything wrong with this code
    By occ0708 in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2004, 12:47 PM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  4. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM