Need DEC C/Borland equivalent of getche() 
Author Message
 Need DEC C/Borland equivalent of getche()


Quote:

>I am trying to write a program from The Waite Groups Programming Using Turbo
>C++. The problem is that it uses the getche() function, not found in the
>compilers I actually have access to: Borland C++ and DEC C.

getche is in BC 1.0, 3.1, and 4.0 (#include conio.h).  

This function seems pretty much specific to DOS compilers.  You might get
more detailed answers to this in comp.os.msdos.programmer[.turbovision]
or comp.os.ms-windows.programmer[.tools.owl].

Quote:

>The getche() function accepts input from the keyboard without echoing the
>character back to the screen. I need this as it is part of a program to
utilize
>ANSI escape sequences. Here's a snippet of code:

>____________________ cut here ________________________

>/* moves cursor diagonally. */
>void main ()

void main is a no no in c.l.c.  To be ansi compliant, main must be defined
to return an int.  Check the c.l.c faq for an explanation.  You can ftp it
from rtfm.mit.edu /pub/usenet/comp.lang.c

Quote:
>{
>        while ( getche() != '\r' )
>                printf("\x1B[B");
>}
>____________________ cut here ________________________

--
John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:



Tue, 24 Mar 1998 03:00:00 GMT  
 Need DEC C/Borland equivalent of getche()

I am trying to write a program from The Waite Groups Programming Using Turbo
C++. The problem is that it uses the getche() function, not found in the
compilers I actually have access to: Borland C++ and DEC C.

The getche() function accepts input from the keyboard without echoing the
character back to the screen. I need this as it is part of a program to utilize
ANSI escape sequences. Here's a snippet of code:

____________________ cut here ________________________

/* moves cursor diagonally. */
void main ()
{
        while ( getche() != '\r' )
                printf("\x1B[B");

Quote:
}

____________________ cut here ________________________

No compilers I know of seem to accept this function. If DEC C and/or Borland
C++ don't have a header file with this function, does anyone know where I coulf
FTP one?

-sw

--

                               -``~  V  ~''-                                    
                               scarlet witch


 ' ' ' ' '  '  '  '    '    '    '     `    `    `    `   `   `   `  `  `  ` `



Tue, 24 Mar 1998 03:00:00 GMT  
 Need DEC C/Borland equivalent of getche()

Quote:

>I am trying to write a program from The Waite Groups Programming Using Turbo
>C++. The problem is that it uses the getche() function, not found in the
>compilers I actually have access to: Borland C++ and DEC C.

Borland C(++) certainly should have getche() - Turbo C++ is just a "limited
edition" of Borland C++.  getche() is prototyped in conio.h.  It may not be
available under Windoze.

Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight


TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html



Tue, 24 Mar 1998 03:00:00 GMT  
 Need DEC C/Borland equivalent of getche()

Quote:

>I am trying to write a program from The Waite Groups Programming Using Turbo
>C++. The problem is that it uses the getche() function, not found in the
>compilers I actually have access to: Borland C++ and DEC C.

While Borland C++ should have it (#include <conio.h>), DEC C should not.
The function is not ISO C.

Quote:
>/* moves cursor diagonally. */
>void main ()

This should be ``int main(void)'' and not ``void main(void)'' As far
as _requiring_ a value to be returned, I am still waiting for Dan Pop's
answer to my question regarding this. :-)

Quote:
>No compilers I know of seem to accept this function. If DEC C and/or
>Borland C++ don't have a header file with this function, does anyone
>know where I coulf FTP one?

For DEC VAX/C, you might want to try the SMG(?) Screen Management library.
On Unix/Ultrix look for curses.  For further info ask in your OS's group.

Best regards,
Derick.
--
+------------------------------------------------------------------------+
| Derick R. Qua-Gonzalez                                      | ________ |
| Department of Physics, California State University          | \      / |

|     ``It is better to be hated for what one is,             |   \  /   |
|       than loved for what one is not.'' (A. Gide)           | 32 \/ USA|
+-------------------------------------------------------------+----------+



Wed, 25 Mar 1998 03:00:00 GMT  
 Need DEC C/Borland equivalent of getche()

asks:

Quote:
>I am trying to write a program from The Waite Groups Programming Using Turbo
>C++. The problem is that it uses the getche() function, not found in the
>compilers I actually have access to: Borland C++ and DEC C.

It is true that getche() is not a standard function.  However,
Borland/Turbo C/C++ provides this function (at least from Turbo 1.0
onwards).  Remember to #include <conio.h>.  More portable non-standard
approaches include using the non-standard ioctl() function to change the
mode of the input device or using the non-standard curses package.

[snip]

Quote:
>void main ()

 ^^^^
 Ms Witch, you've been around here long enough not to do this.
--

* Chicago, IL (USA)    


Thu, 26 Mar 1998 03:00:00 GMT  
 Need DEC C/Borland equivalent of getche()


Quote:
>For DEC VAX/C, you might want to try the SMG(?) Screen Management library.
>On Unix/Ultrix look for curses.  

You could use the Curses library on *both* platforms, believe it or not.

-d

--
A recent quote from a local newspaper credited Jay Leno with a joke that
essentially said, "Oh Jay declined the NBC interview because he'd be taking on
two people without the element of surprise."  That was a *sharp* joke...



Fri, 03 Apr 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Equivalent for getche() function in UNIX C?

2. ANSI equivalent of getche() using linux...

3. Equivalent of Getche(), getch()

4. Equivalent of Getche(), getch()

5. *beginner help needed* getche() function

6. Newbie: separate big .cs file into small .cs files

7. DEC FORTRAN/DEC C character function

8. DEC C and DEC C++ electronic mail survey

9. newbe/cs student, need help w/ code

10. resx files needed for cs - files ??

11. ANSI equivalent of kbhit()(Borland)?

 

 
Powered by phpBB® Forum Software