Thread: problem with string extraction

  1. #1
    Registered User
    Join Date
    Feb 2005

    problem with string extraction

    I am trying to extract the first two characters from a string using getline, is this possible or how can I do the extraction?
    Last edited by robasc; 10-20-2006 at 02:08 AM. Reason: title error

  2. #2
    Join Date
    Jan 2005
    Can't you use getline to get the string and then just access the first two characters by saying:


  3. #3
    Registered User
    Join Date
    Jan 2005
    Or, if you don't want to get the entire line from the stream, just call get() twice to get two characters. Is there a reason you think you need to use getline?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  4. 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
  5. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM