Forum Discussion
Altera_Forum
Honored Contributor
15 years agoalt_getchar returning wrong value
int main()
{
int noia = 0;
alt_putstr("Proc 2!\n");
/* get the mutex device handle */
alt_mutex_dev* mutex = altera_avalon_mutex_open( "/dev/mutex" );
/* acquire the mutex, setting the v...
Altera_Forum
Honored Contributor
15 years agoI'd guess that the result range of alt_getchar() is -1 (no char available) and 0..255 for a received byte (it could also return indications of abort and framing errors) - so the return value could well be 'int' not 'char'.
getchar() will pull in a lot of libc code, and may also (by default at least) require that you type <enter> before making any data available.