[SDL] Re: [HELP] SDL Segmentation
john at johnnypops.demon.co.uk
Sun Jan 8 16:17:50 PST 2006
On Sun, Jan 08, 2006 at 10:24:27PM +0000, Ivan wrote:
> David Olofson <david <at> olofson.net> writes:
> > fgets() writes a NUL byte *after* the last byte read, so this will
> > segfault if the file is longer than 254 bytes.
> > As a general rule when dealing with the string functions of the C
> > library: Be very careful with those NUL terminators and buffer size
> > limits...
> > //David Olofson - Programmer, Composer, Open Source Advocate
> >Perhaps make sure (fin != NULL) after the fopen() call?
> >This doesn't look like an SDL bug.
> Thanks David (and Ryan ^_^) for your help
> (i konw that i'should use a dynamic assignment) but ...
> if i comment (or delete) the SDL initialization,
> my code don't goes in Segmentation;
> if you try (even adding a printf("%d\n",mdl->vtx_num)
> to see if "all" indeed works) it works .... :P
> thanks in advance,
> (i'm really really sorry for my english ....
> i hope that you understand what i'm trying to say)
You're overriding the C-Library function read() with an incompatible one
of your own!
Try changing it to read_model() or something,
More information about the SDL