[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: forum for beginner type questions

From: fpga
Subject: Re: forum for beginner type questions
Date: Thu, 3 Sep 2009 08:11:30 -0700 (PDT)

Thank you all very much for your responses and the info that there's not a
good forum for beginners.
My question may have been inappropriate as this may well be the right forum
after all.

I played around and solved my problem which has highlighted a seeming
inconsistency between mvwaddstr(......const char *), which I initially used,
and mvwaddch(...char) which was my solution to the problem I  was having
with mvwaddstr().

I'm aware of Dan's book and the acclaim it has received but would be very
surprised if it contained an explanation of the difference between
mvwaddstr() and mvwaddch() re the way I am trying to use them.

To reduce duplication I'm writing a pad based text editor as part of a front
end for my discrete event simulation app and using the guts of that editor
for the simulation's dynamic display. 

I need to be able to overwrite existing text on the pad with new text very
quickly indeed.

For speed I went for mvwaddstr() cos many of the chars are adjacent cos they
belong to the same set. However when I cleared the vector holding objects
containing the char *s that had been displayed and refilled it with new ones
for redisplay, ncurses seemed upset by the loss of the deleted char *'s.
This was evidenced by the fact that if I did not delete the char * objects
and simply added new ones to their vector everything printed out as expected
i.e. as a test I printed at x=1 and y=index of char * object in vector. so I
just got a longer list.

To test that the pad was indeed missing the deleted char *s I deleted it,
having created it with new and recreated it assigning to it the similarly
deleted and refilled vector of char *'s to play with and it worked fine.
I feel that this may be a bit slow for the simulation display if not for the
editor part.

To address this I got rid of the char *s altogether and used two loops to go
down the vector of strings and used their indexes as x & y to print each
character using mvwaddch(). I find with this I can change the vector of
strings and just keep writing new text with mvwaddch() without ncurses

I'm not sure if ncurses "mourning" of text supplied to it via mvwaddstr()
but not via mvwadch() is an intended feature and would welcome your thoughts
on this. 

Addionally, thank you for the efforts of you gentlemen in developing and
assisting people like me to use such no-nonsense functional software. I am
trying to write the equivalent of a DOS based app that was extremely
productive compared to it's later Windows gui-based incarnations. I like the
results that ncurses produces a lot!
As an aside and given that it seems best to now write a character at a time
(with its own foreground and background colour) is there a best way to write
the thing to run as fast as possible? I'm using g++ and may possibly move to
Intel's compiler. My app is really only one big loop that writes chars to
the screen with different foreground and background colours.

Again any help is much appreciated


fpga wrote:
> Could someone please direct me to a beginner's forum for ncurses please

View this message in context: 
Sent from the Gnu - Ncurses mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]