[Tutor] Building a simple text editor
Alan Gauld
alan.gauld at btinternet.com
Sat Oct 14 16:52:37 CEST 2006
> I am trying to build a simple text editor which has a couple of
> options of
> editing, displaying and saving the file.
Are you using a GUI or console?
The solution is potentially quite different depending on the choice.
> Now what I want to do is to allow teh user to keep entering the text
> unless
> he pressed ':q'.
How are you reading the characters in the first place?
if you can find a way to read characters from the keyboard
one at a time then
while True
ch = getchar()
if ch ==':'
ch = getchar()
if ch == 'q': break
Will work.
So the question becomers do you know how to write getchar()?
Alan G.
More information about the Tutor
mailing list