Computer Science Canada

getch: argument is wrong type

Author:  someone [ Sat Jun 03, 2006 3:51 pm ]
Post subject:  getch: argument is wrong type

hey guys... i don't really get this .... when i used the getch command.. this is what happens... can anyone help me? Crying or Very sad

Author:  wtd [ Sat Jun 03, 2006 5:17 pm ]
Post subject: 

What happens?

Author:  Null [ Sat Jun 03, 2006 5:20 pm ]
Post subject: 


  • This is the tutorials section. The correct forum is right above this one. Use your eyes.

  • I don't think getch is standard. Try using std::cin.get()

    eg:

    code:

    #include <iostream>

    int main() {
            char ch;
            std::cout << "Enter a character: ";
            ch = std::cin.get();

            std::cout << "You entered " << ch << std::endl;
    }


Author:  [Gandalf] [ Sat Jun 03, 2006 6:00 pm ]
Post subject: 

If I recall correctly, getch() is a standard C method, which can probably be found in <cstdio>, or if you are using C, stdio.h.

Author:  Flikerator [ Tue Jun 06, 2006 12:04 pm ]
Post subject: 

[Gandalf] wrote:
If I recall correctly, getch() is a standard C method, which can probably be found in <cstdio>, or if you are using C, stdio.h.


Wouldn't it be C++ for stdio.h?

Author:  wtd [ Tue Jun 06, 2006 12:16 pm ]
Post subject: 

The stdio.h header is a C header file. C++ and C are different languages that just happen to be mostly compatible. The "cstdio" C++ header exists to wrap stdio.h up so you don't have to worry about the differences between C and C++ when you use it.


: