yeah, my problem was i wasnt initializing it, i made this(copied it from
help_data in recycle.c) and put it in db.c and now pWrd-> works fine
WORDTWIST * word_free;
WORDTWIST * new_word ( void )
{
WORDTWIST * word;
if ( word_free )
{
word = word_free;
word_free = word_free->next;
}
else
word = alloc_perm( sizeof( *word ) );
word->newround = TRUE;
return word;
}
although maybe im missing something because it still doesnt want to work
properly at this part:
bool has_been_guessed( struct wordtwist_data *pWrd, char *word )
{
char log_buf[MAX_INPUT_LENGTH];
int i;
for( i = 0 ; i < pWrd->guess_count ; i++ ) //this crashes on second+
guess
if(!str_cmp(word, pWrd->guesses[i]) )
return TRUE;
return FALSE;
}
i think the problem here is that guesses[i] isnt increasing, and instead
just crashes.
right now im running this on a windows machine, so now gdb(i dont know how
to use it) but im uploading it to my shell right and will put it there, so
once thats going can anyone briefly explain how i can use gdb to single out
the problem here?
From: Davion Kalhen <[EMAIL PROTECTED]>
Reply-To: Davion Kalhen <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: a problem with checking if a word has been entered already
Date: Mon, 23 Aug 2004 12:10:56 -0700
Sounds like your entire variable is uninitalized. It'd be nice if you
showed us a gdb backtrace, so we know exactly whats wrong. Even show
the value of pWrd->newround. But generally, when you create a new
pWrd, via new_word() or something like that, functions are in
recycle.c. They should atleast be initalized to zero. I'm not sure if
newround is a pointer, or not, so I can't tell ya whats wrong. But
honastly it sounds like pWrd is uninitalized. Make sure your setting
it up properly. Maybe show us a code snippet of where it crashes. As
well show us what newround is, and the gdb backtrace! If you don't
know how to use gdb... your screwed! :P Just ask we will tell.
Davion
--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom
_________________________________________________________________
Take advantage of powerful junk e-mail filters built on patented Microsoft®
SmartScreen Technology.
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
Start enjoying all the benefits of MSN® Premium right now and get the
first two months FREE*.