Just a sample of the Echomail archive
COMPLANC:
[ << oldest | < older | list | newer > | newest >> ]
|  Message 242,358 of 243,097  |
|  Richard Harnden to Michael Sanders  |
|  Re: is_binary_file()  |
|  07 Dec 25 19:01:02  |
 
From: richard.nospam@gmail.invalid
On 06/12/2025 01:05, Michael Sanders wrote:
> Am I close? Missing anything you'd consider to be (or not) needed?
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 :)
>
>
|
[ << oldest | < older | list | newer > | newest >> ]
(c) 1994, bbs@darkrealms.ca