How To?

How do you retrieve without echoing a user input or instead echo '*' for all the characters typed?

Comments

  • : How do you retrieve without echoing a user input or instead echo '*' for all the characters typed?
    :

    int getch(void);

  • [b][red]This message was edited by the Bullet_09 at 2002-4-3 16:59:26[/red][/b][hr]
    : : How do you retrieve without echoing a user input or instead echo '*' for all the characters typed?
    : :
    :
    : int getch(void);
    :
    :
    thanks, but is that a built in function?



  • : [b][red]This message was edited by the Bullet_09 at 2002-4-3 16:59:26[/red][/b][hr]
    : : : How do you retrieve without echoing a user input or instead echo '*' for all the characters typed?
    : : :
    : :
    : : int getch(void);
    : :
    : :
    : thanks, but is that a built in function?
    :
    It's a C library function. Defined in conio.h if you're programming for DOS.


  • : : : int getch(void);
    : : :
    : : thanks, but is that a built in function?
    : :
    : It's a C library function. Defined in conio.h if you're programming for DOS.

    getch() is not in the C library, though it may be included in the additional libraries provided by your compiler or operating system. But then again, it may not.

    Cheers,
    Eric
  • Thanks for all the response.


  • :
    : getch() is not in the C library, though it may be included in the additional libraries provided by your compiler or operating system. But then again, it may not.
    :
    See [italic]The Standard C Library[/italic], P.J. Plauger, Prentice Hall, 1992, page 27. Since Plauger is on the ANSI committee X3J11 (for C), I take his word that getch is part of the standard ANSI C library.


  • : : getch() is not in the C library, though it may be included in the additional libraries provided by your compiler or operating system. But then again, it may not.
    : :
    : See [italic]The Standard C Library[/italic], P.J. Plauger, Prentice Hall, 1992, page 27. Since Plauger is on the ANSI committee X3J11 (for C), I take his word that getch is part of the standard ANSI C library.

    We don't have to "take his word" on what might be in the standard, we can look ourselves! If Plauger claims that it is (I highly doubt this, but I don't have the book to check it out), then he is wrong. Again: 'getch()' is [italic]not [/italic]part of the C standard library. Both Borland and MSVC++ provide getch() via the non-standard header . GNU C does not have it at all (though getch() is available via the popular 'curses' library).

    Why? First of all, we can't really say what 'getch' is supposed to do, in any general sense, because it's not defined by any standard. I can only say that in the [italic]implementations I've used[/italic], getch() was defined as "get character without echoing it to the screen". The assumption that you have a 'screen' on which you may see characters as they are 'typed' is a dead give away that getch() could [italic]not[/italic] be part of the standard library. The standard library has no concept of a "screen" or a "keyboard" (this is on purpose, as many platforms on which C is used do not [italic]have[/italic] keyboards or screens). The standard IO library is defined in terms of input and output [italic]streams[/italic] only.

    Cheers,
    Eric


  • I don't know if CodeWarrior has the complete ANSI Library, but I can't find conio.h

    However, it is in MSVC++

  • : I don't know if CodeWarrior has the complete ANSI Library, but I can't find conio.h

    Well, whether or not CodeWarrior "has the complete ANSI library" has little to do with whether it has conio.h, because conio.h is not part of ANSI C.

    : However, it is in MSVC++

    Yup. Yet conio.h is not part of the standard, so every vender's conio.h contains different functions. Compiler FooBar's might contain "Commercial Order Negotiation Infrastructure Objects"... you have no way of knowing.

    Cheers,
    Eric
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories