curs_beep(3X)

✨ curs_beep β€” the bell one πŸ””

okay so bestie, this is a page from the curses library calls manual (yes, section 3X, we're fancy πŸ’…). Let's get into it.


πŸ’– NAME πŸ’–

beep, flash β€” ring the (visual) bell of the terminal with curses


πŸŽ€ SYNOPSIS πŸŽ€

#include <curses.h>

int beep(void);
int flash(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

So beep and flash are both here to alert the terminal user, they just have different love languages πŸ’–

  • beep does it by sounding the terminal's audible alarm.
  • flash does it by visibly attracting attention.

Typically, a terminal pulls off a visual bell by momentarily reversing the character foreground and background colors on the entire display β€” and get this, even a monochrome device can do it. iconic.

Here's the cute part: these functions each attempt the other alert type if the one requested is unavailable. So they've got each other's backs 🫢. And if neither is available? curses just does nothing, no action, periodt.

Nearly all terminals have an audible alert mechanism like a bell or a piezoelectric buzzer πŸ””, but only some can flash the screen. iykyk.


🌸 RETURN VALUE 🌸

These functions return OK on success and ERR on failure.

In ncurses specifically: beep and flash return OK if the terminal type supports the corresponding capability β€” bell (bel) for beep, and flash_screen (flash) for flash. Otherwise they return ERR. πŸ’€


🌈 EXTENSIONS 🌈

In ncurses, these functions can return ERR. (yes that's the whole extension, we love a short king)


πŸ‘‘ PORTABILITY πŸ‘‘

X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them.

On SVr4 curses, they always return OK, and X/Open Curses specifies them as doing so.

so like, if you're porting and relying on ERR… bestie. different curses, different story 😭

🧚 HISTORY 🧚

SVr2 (1984) introduced beep and flash. retro legends, honestly. ✨


⭐ SEE ALSO ⭐


and that's the whole page, no notes πŸ’œ this was ncurses 6.6, dated 2025-02-01 β€” mwah, slay, go ring that bell πŸŽ€πŸ””

πŸ“¦ where this page comes from