How to read input until the user enters ^X

Posted by Koning Baard on Stack Overflow See other posts from Stack Overflow or by Koning Baard
Published on 2010-05-24T07:52:54Z Indexed on 2010/05/24 8:01 UTC
Read the original article Hit count: 191

Filed under:
|
|
|

I am creating an interpreter for my esolang, and I need the user to enter some text which then will be interpreted as an INTERCAL program. I want the user to enter text, which may contain any character including newlines, until the user presses ^X (Ctrl-X), like this:

Enter your code followed by ^X:
Bla
Blablabla
Bla^X
Thank you for entering your code

(line 2, 3 and 4 were entered by the user)

can anyone explain me how I can read input including newlines till the user enters ^X? Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about string