 |
BOOK Beginning Linux Programming, 3rd Edition  | This is the forum to discuss the Wrox book Beginning Linux Programming, 2nd Edition by Richard Stones, Neil Matthew, Alan Cox; ISBN: 9780764543739 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK Beginning Linux Programming, 3rd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 19th, 2005, 11:46 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ipmode.c from chapter 6 [solved]
I tried the ipmode program out, and everything seems to work ok, until the password entry. Sometimes I am not even finished typing the password in, and the program quits on me. But more importantly, once I enter the password, and hit <ENTER>, nothing displays, and the program ends. I thought maybe it was something I did (as I modified the program a little to suit my own tastes), but when I downloaded and compiled the source from the WROX site, I found it had the same problem too. I don't see any problems while running it through the debugger either.
Anyone else have this trouble?
I am running ncurses on Gentoo on an AMD Athlon64 machine with gcc 3.4.3-r1
|
|

August 27th, 2005, 01:37 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am running ncurses on Fedora 3 on an Intel Centrino machine with gcc 3.4.4-2.fc3
I have some little opinion, maybe helpful.
First, I think you should look up the manual for the function of "getch()". Maybe there is some restriction on "gentoo"??
Or you can try to update you gcc and other system programs.
Last maybe it was caused by the AMD processor. But I have no idea for this reason.
--
I am just a new Linux user. ^^
|
|

August 27th, 2005, 09:09 PM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The problem may be that it prints "Correct" or "Wrong" to the screen then immediately exits. Try adding something so you regain control of when it exits. Something like
#define FOO_LEN 25
char foo[FOO_LEN];
/* Then, down at the end, after this */
move(11, 10);
if (strcmp(password, real_password) == 0) printw("%s", "Correct");
else printw("%s", "Wrong");
refresh();
/* add this */
move(13, 10);
printw("%s", "exit?");
getstr(foo);
endwin();
exit(EXIT_SUCCESS);
Then you can see it and hit "Enter" to exit.
|
|

October 10th, 2005, 01:12 PM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah, that seems to work. Cool.
|
|
 |