curses.h, beep() returns ERR, flash() casuses segment fault.
Daniel Molina Wegener
dmw at unete.cl
Thu Aug 28 05:15:10 UTC 2008
On Wednesday 27 August 2008 22:10:40 Christopher Joyner wrote:
> I do not get the OK from beep, and flash crashes the program.
> This is my code:
First, take a look on the manual page...
>
> #include <curses.h>
>
> int main(int argc,char** argv)
> {
> if(beep()!=OK)
> printf("No OK\n"); fflush(stdout);
> if(flash()!=OK)
> printf("No Flash\n"); fflush(stdout);
> return 0;
> }
Well, try:
#include <stdlib.h>
#include <stdio.h>
#include <curses.h>
int
main(int argc,char** argv)
{
/* in curses(3X) manual page... */
initscr();
if (beep() != OK)
printf("No OK\n"); fflush(stdout);
if (flash() != OK)
printf("No Flash\n"); fflush(stdout);
return 0;
}
And read the curses manual page, you forgot to init
the screen.
>
>
>
> In Love in Jesus Christ, Or Lord and Savior.
>
>
> For God so loved the world, that he gave his only *begotten
> Son, that whosoever believeth in him should not perish, but
> have everlasting life. --John 3:16
>
>
> [SNIP]
Regards,
--
.O. | Daniel Molina Wegener | C/C++ Developer
..O | dmw [at] unete [dot] cl | FOSS Coding Adict
OOO | FreeBSD & Linux User | Standards Rocks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080828/4ca6915d/attachment-0001.pgp
More information about the freebsd-questions
mailing list