c - Escape sequence \a is not working -


i have following piece of c language code, running on friend's laptop not working in laptop.

in code afer time period wanted make alert beep, not working, please.

for(i=1;i<10;i++) {  delay(500);  if(i==9)     printf("time \a"); } 

is there solution in c resolve sort of dependency

perhaps output stays in stdio buffer (each file, notably stdout buffered; see setvbuf(3)).

i suggest adding call fflush(3) e.g.

for(i=1;i<10;i++) {   delay(500);    if(i==9) {     printf("time \a");     fflush(stdout);   } } 

btw, call fflush(null); flush every file buffer.

i not familiar delay. assume kind of sleep(3).

as rule of thumb, if not ending printf format strings \n or if stdout not terminal, should call fflush (especially delay or sleep). don't call neither.

ps. consider installing linux on laptop[s]. , consider using gcc (perhaps later customizing melt). fun, , free software can study internal implementations.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -