Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 May 2006 20:40:22 +0200
From:      "Pietro Cerutti" <pietro.cerutti@gmail.com>
To:        Micah <micahjon@ywave.com>
Cc:        Andy Greenwood <greenwood.andy@gmail.com>, FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: C coding question
Message-ID:  <e572718c0605171140j526f46e3u477810fa91a33ef9@mail.gmail.com>
In-Reply-To: <446B6995.1030602@ywave.com>
References:  <3ee9ca710605171109i57ae4064x702216a1619d6c41@mail.gmail.com> <446B6995.1030602@ywave.com>

index | next in thread | previous in thread | raw e-mail

On 5/17/06, Micah <micahjon@ywave.com> wrote:
> Andy Greenwood wrote:
> > I am helping someone work on porting some code to Freebsd, and the
> > code below works on Linux, but not on FreeBSD (compiles, but gives
> > Segmentation Fault: 11). I'm not sure where the problem is, and any
> > pointers would be much appreciated.
>
> That's funny, it doesn't even compile on my freebsd:
>
> trisha% cat test.c
> /* Check if we must stop */
> if(tf_stat_file != NULL)
> {
>    tf_stat = fopen(tf_stat_file, "r");
>    if (tf_stat != NULL)
>    {
>      /* Get state */
>      stat_state=fgetc(tf_stat);
>
>      /* Torrentflux asked to shutdown the torrent */
>      if (stat_state == '0')
>      {
>        mustDie = 1;
>      }
>    }
>    fclose(tf_stat);
> }
> trisha% cc test.c
> test.c:2: error: syntax error before "if"

AFAIK, the code should be put inside a function at least to compile ;-)
>
> IOW, if you expect usable help please supply some context.

I agree..

>
> Later,
> Micah
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>


-- 
Pietro Cerutti
ICQ: 117293691
PGP: 0x9571F78E

- ASCII Ribbon Campaign -
 against HTML e-mail and
 proprietary attachments
   www.asciiribbon.org

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e572718c0605171140j526f46e3u477810fa91a33ef9>