By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,819 Members | 1,173 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,819 IT Pros & Developers. It's quick & easy.

Getline delimiter

P: n/a
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==-
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Chris Schumacher wrote:
Is there a way to set the delimiter to the "enter" key? I've tried the
ASCII values for carriage return,
I guess you mean newline here.
line feed, form feed, and even null but it doesn't work.


"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.

Jul 19 '05 #2

P: n/a
"Chris Schumacher" <ke*****@hotmail.com> wrote...
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.


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
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.