Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
 
Old August 19th, 2005, 11:46 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old August 27th, 2005, 01:37 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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. ^^

 
Old August 27th, 2005, 09:09 PM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old October 10th, 2005, 01:12 PM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, that seems to work. Cool.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing a SubForm Only (SOLVED) eusanpe Access VBA 2 April 16th, 2008 09:01 AM
problem solved bhavna .NET Framework 1.x 1 March 7th, 2007 12:20 PM
My Homework (I solved it) yui0329 C# 1 June 10th, 2005 11:25 AM
Problem Solved. blackdevil1979 Beginning VB 6 0 March 22nd, 2005 09:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.