Has anyone here developed a text editor using C ? If so pls share
the ideas with me.
You should probably ask in a C newsgroup (comp.lang.c), and not
here. The appropriate solutions in C++ won't be legal C, by a
long shot.
I have some basic doubts on how to edit the text in stdout as per the
input from keyboard.
An editor won't normally edit text in stdout (nor in cout in
C++). It will edit text in a buffer. That buffer is normally
filled by reading a file, and saved afterwards by writing to a
file.
Also whenever the user inputs any characted to a IO function like
scanf, the character is displayed in stdout.. how can I block it.
You mean: how do you turn off echoing? (The character is *not*
displayed in stdout. It is echoed at a much lower level.) The
simple answer is that you can't. For a more complex answer, see
below.
This sounds a bit like a school project, since anyone really
writing an editor today would already be thinking in terms of
windows in a GUI (and the company would also put a least one
person with real experience on the project, to whom you'd be
asking questions before posting here). If you really know that
little about it, I'd very strongly suggest you get the book
"Software Tools in Pascal", by Kernighan and Plauger. (Dispite
the title, the code is "Pascal" only with regards to the actual
syntax; it's very, very C-like in style---not surprising
considering the authors
. Also note that the book is very
dated, and I'm sure that at least Plauger would not hesitate to
use classes and other C++ features were he writing it in C++,
today. But the ideas are still valid, and very well presented.)
Amongst the tools they describe is a simple command line editor,
which is probably about all you'll be able to accomplish in a
school project (and which is also a good start for a more
complex editor).
If you want or need to go beyond a simple command line editor,
the next step would be to use a portable library to manage
"windows" in a terminal: curses/ncurses seems to be the de facto
standard. And the same thing more or less applies for a GUI:
I'd check out wxWidgets, if I were you. (This commits you to
real C++, and not just C. But you don't really want to write
anything as complicated as a GUI in C anyway.) But be aware
that the issues are complex, and try to only take on one thing
at at time.