digitalmars.D.learn - isBinary
- Vino (7/7) Sep 03 2023 Hi All,
- FeepingCreature (9/16) Sep 03 2023 Those are totally different ideas.
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
Sep 03 2023
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, VinoThose 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.
Sep 03 2023
On Sunday, 3 September 2023 at 10:15:31 UTC, FeepingCreature wrote:On Sunday, 3 September 2023 at 10:11:22 UTC, Vino wrote: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, VinoHi 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, VinoThose 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.
Sep 03 2023
On Sunday, 3 September 2023 at 13:55:45 UTC, Vino wrote:f.open(fn, "rb");here you command to your pc: "now open fn and treat is as binary file"
Sep 12 2023