[luau] C program question

Eric Hattemer hattenator at imapmail.org
Fri May 24 02:02:00 PDT 2002


I'm willing to bet Ray's way is the simplest way to make a "Press any key"
prompt.  Dean's method is another "Press Enter to continue" prompt.  So if
you really want "any key", You probably have to include all of Ray's code.
But in C to do a "Press Enter" is just something like
void func()
{
char temp;
printf("\nPress Enter to Continue");
scanf("%c",&temp);
return;
}
Of course there's a billion ways to do it, but there's a few lines.  Ray's
way would be more lengthy, and if this is for fun, then that's probably the
way to go.  But if people can afford to hit enter, then I say be lazy and
use this type of a prompt.

-Eric Hattemer

----- Original Message -----
From: "Ben Beeson" <beesond001 at hawaii.rr.com>
To: <luau at videl.ics.hawaii.edu>
Sent: Thursday, May 23, 2002 6:30 PM
Subject: Re: [luau] C program question


> Eric, Ray, and Dean,
>
> Wow, what great help!  I'll have to try as much of what each of you
suggest
> as I can.  The short story is I snipped a piece of code from an old
Borland C
> program, and said h-m-m-m  how do I do this with Linux???  A few manpages
and
> googles searches later landed me with the getch() function in <curses.h> ,
> that's when the trouble started...
>
> Why "fprintf()"?  Just 'cuz mostly.  I'm still learning because I don't
> program for a living, only when I have time and a pet problem I want to
play
> with.  Usually that means I try to find a new way to do a mundane things
once
> in a while.  In this case, I thought I'd try fprintf just to see what I
could
> do with it.
>
> Thanks for the pointer on the "el" switch, and now that I know about
> <termios.h>, I guess I'll be playing with that too.
>
> Dean, your idea looks pretty short and sweet, when I get to C++, I'll try
> that one too.
>
> Thanks again for all your help, I'll fool with this some more and see what
I
> can get to work.
>
> Mahalo,
>
> Ben





More information about the LUAU mailing list