Re: GCC 3.2 replacement for streammarker?
On 27-Oct-02, 11:09 (CST), Steve Greenland <steveg@moregruel.net> wrote:
> int my_fgetc(FILE *foo) {
> int c;
> if (bp) {
> if (*bp != '\0') {
> c = (int) *bp++;
> } else {
> bp == NULL;
> }
> } else {
> c = fgetc(foo);
> if (dobuf) {
> add_to_buf(c);
> }
> }
> return c;
> }
Oops. That's wrong. Here's a better version:
int my_fgetc(FILE *foo) {
int c;
if (bp) {
if (*bp != '\0') {
c = (int) *bp++;
} else {
bp == NULL;
c = fgetc(foo);
}
} else {
c = fgetc(foo);
}
if (dobuf && !bp) {
add_to_buf(c);
}
return c;
}
--
Steve Greenland
The irony is that Bill Gates claims to be making a stable operating
system and Linus Torvalds claims to be trying to take over the
world. -- seen on the net
Reply to: