Hi. I'm starting to learn C from the beginning again after a long time. As i wrote the program for the second exercise of the first chapter of Kernighan & Ritchie's book and learned to make my pc speaker beep, i began to wonder how to output many beeps through the pc speaker using the printf function only. By that i mean a single printf execution (no loops or things like that.)
I was hoping that a code as simple as this would work:
but unfortunately, it didn't. I wonder why there is some sort of "asymmetry" among escape sequencies. I'll make my point clearer. I can use the code above, replacing \a\a by \n\n to output two newline characters one inmediately after the other. However, this is not possible when it comes to \a. I don' hear two beeps one after the other.Code:#include <stdio.h> main() { printf("\a\a"); }
I hope you can guide me towards the resolution of this problem i have.
Thank you very much,
Roberto.