Just a sample of the Echomail archive
COMPLANC:
[ << oldest | < older | list | newer > | newest >> ]
|  Message 242,369 of 243,097  |
|  Michael Sanders to Richard Harnden  |
|  Re: is_binary_file()  |
|  08 Dec 25 18:07:26  |
 
From: porkchop@invalid.foo
On Sun, 7 Dec 2025 19:01:02 +0000, Richard Harnden wrote:
> A text file is supposed to end with a '\n' (M$, of course, largely
> ignores this convention), but a quick test could be:
>
> f = fopen(path, "rb");
>
> fseek(f, -1, SEEK_END);
>
> if ( (c = fgetc(f)) == '\n' )
> printf("Text\n");
> else
> printf("Binary\n");
>
> fclose(f);
>
> Be aware of false positives/negatives, because I'm sure there will be
> plenty :)
Thank you Richard. Interesting thoughts.
--
:wq
Mike Sanders
--- SoupGate-Win32 v1.05
* Origin: you cannot sedate... all the things you hate (1:229/2)
|
[ << oldest | < older | list | newer > | newest >> ]
(c) 1994, bbs@darkrealms.ca