C
clusardi2k
/*
The below code on SGI will wait for you to enter 2 things, but
on Linux it will only wait the first time.
I can make the code work by replacing the scanf with:
char data [5];
fgets (data,5,stdin);
the_number = atoi (data);
But, instead I would like to modify the scanf, "/dev/tty", or
something simple like that.
*/
#include <stdio.h>
int main()
{
int c;
int the_number;
fprintf (stderr,"Enter Number :");
scanf ("%d",&the_number);
fprintf (stderr,"\nEnter a letter :");
c = getchar ();
if ( (c = getchar ()) == EOF )
freopen ("/dev/tty","r",stdin);
else
ungetc (c,stdin);
return (0);
}
The below code on SGI will wait for you to enter 2 things, but
on Linux it will only wait the first time.
I can make the code work by replacing the scanf with:
char data [5];
fgets (data,5,stdin);
the_number = atoi (data);
But, instead I would like to modify the scanf, "/dev/tty", or
something simple like that.
*/
#include <stdio.h>
int main()
{
int c;
int the_number;
fprintf (stderr,"Enter Number :");
scanf ("%d",&the_number);
fprintf (stderr,"\nEnter a letter :");
c = getchar ();
if ( (c = getchar ()) == EOF )
freopen ("/dev/tty","r",stdin);
else
ungetc (c,stdin);
return (0);
}