How to read input until user logs in ^ X

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

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

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

Can someone explain to me how I can read input, including newlines, until the user goes into ^ X? thank

+3
source share
2 answers

^ X has an ASCII code of 24, try checking this out.

http://www.unix-manuals.com/refs/misc/ascii-table.html

+1

^ D.
EOF .

, .
. , .

+1

Source: https://habr.com/ru/post/1746828/


All Articles