hey guys does anyone know why this code will not make a sound alert im compiling it in ansi c using linux?
Code:#include <stdlib.h>
#include <stdio.h>
int main (void)
{
char beep = '\007';
printf("%c", beep);
return EXIT_SUCCESS;
}
Printable View
hey guys does anyone know why this code will not make a sound alert im compiling it in ansi c using linux?
Code:#include <stdlib.h>
#include <stdio.h>
int main (void)
{
char beep = '\007';
printf("%c", beep);
return EXIT_SUCCESS;
}
Most likely because your terminal isn't setup/configured to beep when it receives the ASCII BEL character.
By the way, you should use '\a' for a beep, it doesn't assume ASCII and isn't a magic number.
The alert character (\a), added by C90, produces an audible or visible alert. The nature of the alert depends on the hardware, with the beep being the most common. (With some systems, the alert character has no effect.)
Do you mean C89?Quote:
added by C90
My Linux terminal doesn't beep by default, either. DOS does. You'll have to configue your terminal if you really want to have your ears blasted away.Quote:
im compiling it in ansi c using linux