Is it possible to make the utility like in vi, where the user keeps on entering the data and when he hits ':wq', the work is saved and the application exists.
I guess the use of standard input file would be applicable???
Thanks.
Regrds,
Asrar
On 10/14/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> 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.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
To HIM you shall return.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor