On Sunday, 3 September 2023 at 10:15:31 UTC, FeepingCreature
wrote:
On Sunday, 3 September 2023 at 10:11:22 UTC, Vino wrote:
Hi All,
Any update as to when the function described in the below
ticked would be action-ed, I am more interested in isBinary
(check a file whether is is binary file or not)
http://d.puremagic.com/issues/show_bug.cgi?id=9455
From,
Vino
Those are totally different ideas.
When writing a file, some operating systems support line ending
conversion. To do that, you explicitly specify that you are
writing to a text file. Then a "binary file" is just any file
that is not a text file. However, this is merely a conversion
process on writing. You cannot discover whether a file is a
binary file in reverse. At most you can check whether *you
yourself* opened the file as a binary file.
I tried to write the below code but it always return's as binary
for any file type, please point me what is wrong in the below
program
```
void main () {
import std.stdio: writeln, File;
string fn = "C:\\temp\\test.txt";
//string fn = "C:\\WINDOWS\\system32\\whoami.exe";
File f;
f.open(fn, "rb");
if(f.isOpen) { writeln("BinaryFile"); } else {
writeln("NotBinaryFile"); }
f.close();
}
```
From,
Vino