Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > BOOK Beginning Linux Programming, 3rd Edition
Password Reminder
Register
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
  #2 (permalink)  
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. ^^

  #3 (permalink)  
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.

  #4 (permalink)  
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.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:46 AM.


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