On Fri, Mar 28, 2003 at 06:18:04PM +1200, David Mann wrote:
> >         char * sQuote;
> 
> I declare all my local variables at the start of the function (ie where 
> you declare 'myfile').  Its easier to keep track of them.

Indeed. also, gcc wont accept variables declared anywhere except the start
of a block. (not sure about other compilers).

Anyway, I wasnt going to respond, but as David mentioned, The segfault is
due to sQuote not pointing to a valid memory block. you'd need to malloc()
it, or give it a static size.

I cant remember, but I also seem to be thinking that fread() (? or was it
fgets?) doesnt add a null.. so you'd need to:

allocate 256 bytes to sQuote.
read 255 chars into sQuote.
set sQuote[256] to NULL
compare.

Mike.
-- 
Mike Beattie <[EMAIL PROTECTED]>                      ZL4TXK, IRLP Node 6184

    "Why Not? I'm drunk right now."    -- Anthony Towns when asked about
       naming the next Debian release after the winner of an auction.

Reply via email to