![]() |
| | #1 |
| Registered User Join Date: Dec 2001
Posts: 227
| curses[help] i have coded a simple hello word but in curses... now my problem is that it wont print out the hello word... but if i was to take out endwin(); from the code then it will print but yet my terminal starts to act as if it was in a loop but then again it prints out "hellow word"... can anyone tell me why.. ? Code:
#include <curses.h>
int main()
{
initscr(); //starts the loop
printw("hello word"); //prints hello word
refresh(); //prints it to the real screen // stdscr
endwin(); //ends curses
}
|
| xlordt is offline | |
| | #2 | |
| B26354 Join Date: Jan 2002
Posts: 631
| Re: curses[help] Quote:
Code: #include <curses.h>
int main()
{
initscr(); //starts the loop
printw("hello word"); //prints hello word
refresh(); //prints it to the real screen // stdscr
sleep(2); /* curses.h includes what we need to sleep */
endwin(); //ends curses
}
__________________ Jason Deckard | |
| Deckard is offline | |
| | #3 |
| Registered User Join Date: Dec 2001
Posts: 227
| see what i did was i added getch() but then again getch doesnt for all the times.. so i will not try sleep() i hope that works for the rest of the progz.. thanx for your help |
| xlordt is offline | |
| | #4 |
| B26354 Join Date: Jan 2002
Posts: 631
| Glad I could be of help. The purpose of the sleep() statement was to let you see that the message was being printed (before being wiped out), and probably shouldn't be used outside of basic examples such as the one I provided.
__________________ Jason Deckard |
| Deckard is offline | |
| | #5 |
| Registered User Join Date: Dec 2001
Posts: 227
| ya i can see thanx again... i sure hope i can get better at curses cause there are not to many tutorials out there... do you know a book that helps you learn curses.. ? |
| xlordt is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|