Thread: password via istream

  1. #1
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18

    Thumbs down password via istream

    to be short, i need a (way/code preferably a manipulator of i stream..)to input a password(string) form the user without echoing it on screen...no library functions has to be used e.g. getpass() of the nonstandard conio.h

    plz..suggest yr ideas n ask me if any doubts.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    I believe this is not possible.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    i have asked the same qn. to many many people...but all hav replied it as "not possible".
    all i want is to toggle echoing on and off the std ostream..if this is achieved then the problem is done...

  4. #4
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    i have an idea but right now dont know how to implement it..
    first the standard output buffer is changed to a local buffer.
    now the string is read..it would not get echoed on the screen(std o/p device as the buffer has been changed)..
    now the standard buffer is restored..

  5. #5
    Registered User
    Join Date
    Apr 2004
    Posts
    173
    This is platform dependent issue - you need to turn it off in a terminal/shell or using a system-dependent function.
    The cost of software maintenance increases with the square of the programmer's creativity.

  6. #6
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Have you tried a google? But I think laserlight is correct in his assumption. There is no standard way to do that.

    Oh and congrats on your new Mod positon laserlight!
    Double Helix STL

  7. #7
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    Is there any other way to implement this...?

  8. #8
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    hey guys i tried it in google, comp.lang.c++ etc...all say there is no standard way...but guys i found this actually in Bjarne Stroustrup's book...so there is a way of achieving this...yet it is unknown..!

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    but guys i found this actually in Bjarne Stroustrup's book...so there is a way of achieving this...yet it is unknown..!
    What exactly did Stroustrup say?

    Oh and congrats on your new Mod positon laserlight!
    Thank you.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    the actual question was to create two stream manipulators that toggles the echoing on and off.

  11. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    the actual question was to create two stream manipulators that toggles the echoing on and off.
    Kindly provide the relevant quote from the book.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #12
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    sorry i don remember the entire question.
    its on the exercise section of this book.(at the end of chapter 21.Streams)

    The C++ Programming Language 3rd ed
    from the Creator Of C++,
    Bjarne Stroustrup.
    Addison Wesley Publications.

  13. #13
    Registered User
    Join Date
    Apr 2007
    Location
    india->tamil nadu
    Posts
    18
    hey did any one find the answer?

  14. #14
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Have you provided the exact quote yet?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #15
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    We're still waiting for you to cite your references.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading a password from a file.
    By medeshago in forum C Programming
    Replies: 15
    Last Post: 12-21-2008, 07:20 AM
  2. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 03:42 AM
  3. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM