#include
int main(void)
{
printf("\a");
return 0;
}
PROGRAM 2 :
#include/* beep1.c */
#include
#include
int main(void)
{
int i, j, speed = 2000;
printf("1 \a \n"); /* works with just stdio.h */
Sleep(1000); /* need windows.h */
/* must wait before dings or I won't get ding
I guess 'cause it's working so hard to make it: ) */
printf("2 \n");
putchar(0x07); /* works with just stdio.h */
Sleep(1000);
printf("3 \n");
Beep(2750, speed); /* need windows.h */
Sleep(1000);
printf("4 \n");
_beep(2750, speed); /* need stdlib.h */
_sleep(1000); /* need stdlib.h */
/* I get the same Beep for all of these */
for(i = 400; i <= 2000; i += 400 ) {
for(j = 400; j <= 2000; j += 400) {
printf("Beep(%d, %d) \n", i, j);
Beep(i, j);
/* Beep(200, speed); */
Sleep(1000);
}
}
return 0;
}
/*
Here's where they come from in my mingw - includes directory:
-----
winbase.h
BOOL WINAPI Beep(DWORD,DWORD);
-----
stdlib.h
/ *
* NOTE: Officially the three following functions are obsolete. The Win32 API
* functions SetErrorMode, Beep and Sleep are their replacements.
* /
_CRTIMP void __cdecl _beep (unsigned int, unsigned int);
_CRTIMP void __cdecl _seterrormode (int);
_CRTIMP void __cdecl _sleep (unsigned long);
No comments:
Post a Comment