Getline delimiter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Schumacher

    Getline delimiter

    Is there a way to set the delimiter to the "enter" key? I've tried the
    ASCII values for carriage return, line feed, form feed, and even null
    but it doesn't work.
    Thanks.
    -==Kensu==-
  • Rolf Magnus

    #2
    Re: Getline delimiter

    Chris Schumacher wrote:
    [color=blue]
    > Is there a way to set the delimiter to the "enter" key? I've tried the
    > ASCII values for carriage return,[/color]

    I guess you mean newline here.
    [color=blue]
    > line feed, form feed, and even null but it doesn't work.[/color]

    "doesn't work" is not a good description. Post a minimal, but complete
    program that shows the behaviour you observe and describe what happens
    instead of the expected.
    The default delimeter for getline is newline, so it should actually work
    if you don't explicitly provide one.

    Comment

    • Victor Bazarov

      #3
      Re: Getline delimiter

      "Chris Schumacher" <kensu__@hotmai l.com> wrote...[color=blue]
      > Is there a way to set the delimiter to the "enter" key? I've tried the
      > ASCII values for carriage return, line feed, form feed, and even null
      > but it doesn't work.[/color]

      There is no such thing in C++ as <<"enter" key>>, so, no it is not
      possible without going to some kind of platform-specific functionality.

      If you explain what problem you're trying to solve, and post the code
      that you think doesn't work, perhaps we'd be able to recommend some
      solution.

      Just a hunch: there is a version of the standard library out there in
      which in order to get 'getline' to return you have to press "Enter"
      twice. All you need is to find a better version of the standard
      library, I guess.

      Victor


      Comment

      Working...