:: Re: [DNG] simple-netaid from scratc…
Kezdőlap
Delete this message
Reply to this message
Szerző: Jim Jackson
Dátum:  
Címzett: s@po
CC: aitor_czr, dng
Tárgy: Re: [DNG] simple-netaid from scratch



On Sat, 8 Jun 2019, s@po wrote:

> On Sat, 1 Jun 2019 08:31:49 +0000
> aitor_czr <aitor_czr@???> wrote:
>
> Hello aitor,
>
> >
> > Look at the "netstat.c" file again. I'm using
> >
> > status = fgets ( buffer, sizeof(buffer), fp );
> >
> > instead :)
> >
> > Aitor.
> >
> >
>
> I understood that, from the beguining.. :)
> You don't need the 'sizeof *buffer', since you have a fixed array size of 512 bytes..
> And a byte, is a byte in 32 bits or 64 bits systems ;)
>
> Becasue of that, I suggested changing it to:
> #define BUFFER_SIZE 512
>
> and then:
> status = fgets ( buffer, BUFFER_SIZE, fp );
>
> It was only a sugestion ;)
> Its not wrong, to use it( even tough you are heavilly relying on that unary operator.. for a fixed array size, of n bytes.. )
>


sizeof() is calculated by the compiler, not at run time. The code
generated would be the same.