February 09, 2005 testing for eof | ||||
---|---|---|---|---|
| ||||
Is there a better way to test for EOF in a string (char[])? char c = getchar(); token = toString(c) if(cast(int)token[0] != 255) // this works (seeking better) { .. } Thanks, Rev |
February 09, 2005 Re: testing for eof | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rev | Rev wrote:
> Is there a better way to test for EOF in a string (char[])?
>
> char c = getchar();
> token = toString(c)
> if(cast(int)token[0] != 255) // this works (seeking better)
> {
> ..
> }
int i = getchar();
if (i != EOF)
{
char c = i;
...
}
--anders
|
Copyright © 1999-2021 by the D Language Foundation