Gábor Kövesdán wrote, On 10.3.2009 22:33:
> Hello,
[...]
> And the problem occurs in grep_fgetln() when the buffers is being filled
> in:
>for (; i < bufsiz && !grep_feof(f); i++)
>binbuf[i] = grep_fgetc(f);
>
Also, why are you filling the buffer char by char? All of th
Gábor Kövesdán wrote, On 10.3.2009 22:33:
> Hello,
>
> I have a problem when reading files with fgetc when a 0xff character
> comes. In my code the reading stops at that point as if EOF had been
> reached, but that's not actually the case.
> The code is here:
> http://p4web.freebsd.org/@md=d&cd=//
James Bailie escribió:
fgetc() returns an int so that EOF may be distinguished from valid
return values. Valid values are 8-bit values. EOF is a 32-bit value.
EOF is a 32-bit two's-complement -1 (0x), and -1 input is 8-bit
two's-complement -1 (0xff). When fgetc() casts this to an int,
I must correct myself. It's more likely the return value of fgetc(),
after having been assigned to a char, is being sign-extended when that
char is compared to the in EOF, so that the comparison becomes a
comparison between 0x and 0x.
James Bailie wrote:
...EOF is getting cast t
fgetc() returns an int so that EOF may be distinguished from valid
return values. Valid values are 8-bit values. EOF is a 32-bit value.
EOF is a 32-bit two's-complement -1 (0x), and -1 input is 8-bit
two's-complement -1 (0xff). When fgetc() casts this to an int, it
becomes 0x00ff,
Xin LI escribió:
Is binbuf[] an array of char or unsigned char? If it's signed char then
you may want something like ch = binbufptr[0] & 0xff I guess.
Hi,
thanks, it is now satrting to work, binbuf was of signed int. But now,
I've got one more of that strange character at the end of the o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi, Gábor,
Gábor Kövesdán wrote:
> Ed Schouten escribió:
>> * Gábor Kövesdán wrote:
>>
>>> Hello,
>>>
>>> I have a problem when reading files with fgetc when a 0xff character
>>> comes. In my code the reading stops at that point as if EOF had been
Ed Schouten escribió:
* Gábor Kövesdán wrote:
Hello,
I have a problem when reading files with fgetc when a 0xff character
comes. In my code the reading stops at that point as if EOF had been
reached, but that's not actually the case.
The code is here:
http://p4web.freebsd.org/@md=d&cd
* Gábor Kövesdán wrote:
> Hello,
>
> I have a problem when reading files with fgetc when a 0xff character
> comes. In my code the reading stops at that point as if EOF had been
> reached, but that's not actually the case.
> The code is here:
> http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//dep
Hello,
I have a problem when reading files with fgetc when a 0xff character
comes. In my code the reading stops at that point as if EOF had been
reached, but that's not actually the case.
The code is here:
http://p4web.freebsd.org/@md=d&cd=//&c=Nsd@//depot/projects/soc2008/gabor_textproc/grep/
10 matches
Mail list logo