Thread: putch(''); ??????

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    putch(''); ??????

    What the freak is putch??? what is it used for????? How do you use it?????



    PS:thank you if you helped, and don't say nuttin bout no homework cause it aint
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    It's a non-standard function to output one character, unbuffered. The oposite to getch().
    zen

  3. #3
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    int putch(int) is again another nonstandard function. It does the same as putc() or putchar().As far as I can remember it takes an int which it prints as a char.If not successful putch in returns EOF.If successful it returns the int that was passed.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  4. #4
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    simple.
    If you are not in graphics mode,
    putch('@')
    if you are in graphics mode,
    putchar('@')

    anyway to your question
    I know, in your case, your trying to do the thingy with the arrow keys thingy majiggy i think...

    well putch or putchar 'Puts' the character to the specified location on the screen. For example:
    Code:
    #include <conio.h>
    #include <stdio.h>
    int main(void)
    {
         gotoxy(15,10); //Go to the center of the screen
         putch('A'); 
         gotoxy(0,0); //go to the top of the screen
         putch('B');
         return(0);
    }
    If you compile and run this there should be an A in the center of the screen, and a B in at the top of the screen. In your case you can simply say printf(), but this has some weird hidden advantages.
    In other words, its printf() or cout, exept it can only print out one character.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C to C++
    By $l4xklynx in forum C++ Programming
    Replies: 15
    Last Post: 03-06-2009, 10:45 AM
  2. Flushing buffer
    By $l4xklynx in forum C Programming
    Replies: 6
    Last Post: 03-04-2009, 10:07 PM
  3. Putch - conio
    By black187 in forum Linux Programming
    Replies: 1
    Last Post: 05-11-2006, 01:25 AM
  4. help on program
    By robasc in forum C Programming
    Replies: 31
    Last Post: 03-29-2005, 11:04 AM
  5. How come this statement not work?
    By why in forum C++ Programming
    Replies: 4
    Last Post: 11-03-2001, 07:41 PM