Thread: String input

  1. #1
    Registered Usurer
    Join Date
    Apr 2005
    upstate NY

    String input

    I've been searching for the answer to this question, but no luck so far -

    How can I input strings like

    Bach, Johann Sebastian

    Mozart, Wolfgang Amadeus ??

    I'm sure there's a way to include spaces in a string but I'm at a loss here.

    (For the inevitable 'read the FAQ' posters, please help me find it!)

    Thanks -


  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    New York
    fgets will read until a newline (\n) or EOF is reached.

    Edit edit: This is C++; Use:

    The first being compatible for char*, second for std::string's
    Last edited by Tonto; 09-11-2005 at 12:56 PM.

  3. #3
    Registered Usurer
    Join Date
    Apr 2005
    upstate NY
    Cool - thank you!

    edit - Ah, even better! Thanks again-
    Last edited by -JM; 09-11-2005 at 02:07 PM. Reason: update

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char Handling, probably typical newbie stuff
    By Neolyth in forum C Programming
    Replies: 16
    Last Post: 06-21-2009, 04:05 AM
  2. Replies: 14
    Last Post: 01-18-2008, 04:14 PM
  3. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  4. can anyone see anything wrong with this code
    By occ0708 in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2004, 12:47 PM
  5. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:03 AM