All right... This is a really weird problem. I am writing a software parsing log files in CSV format from several different types of logs into one file ordered by date and time and lots of other formatting. Files that are less than standard is used as input and the plan is to have properly formatted CSV as output.
This is not very complicated to do and everything is working all right, except for the bug I found making the whole thing go in an endless loop when you feed an empty file. Probably an easy fix.
For the time being, I am feeding the files manually, at compile time. I am skipping all empty files because I really don't need to parse those. So I pick the files that Finder tells me is not empty.
Suddenly my software hangs in an endless loop on something that seems like a valid file. I open the file in an text editor, but the editor insists the file is empty. Finder says there is 286 bytes.
Usually I would think that the text editor was wrong and not the operating system, so I did some more investigation. Hex fiend is a Hex editor, it loads binary files, shows whats inside even if there are only 286 spaces you will see it. Surprise! The file really IS 0 bytes! (see my attached picture)
So... What is going on? Why is Finder reporting empty files as having 286 bytes?
This is not very complicated to do and everything is working all right, except for the bug I found making the whole thing go in an endless loop when you feed an empty file. Probably an easy fix.
For the time being, I am feeding the files manually, at compile time. I am skipping all empty files because I really don't need to parse those. So I pick the files that Finder tells me is not empty.
Suddenly my software hangs in an endless loop on something that seems like a valid file. I open the file in an text editor, but the editor insists the file is empty. Finder says there is 286 bytes.
Usually I would think that the text editor was wrong and not the operating system, so I did some more investigation. Hex fiend is a Hex editor, it loads binary files, shows whats inside even if there are only 286 spaces you will see it. Surprise! The file really IS 0 bytes! (see my attached picture)
So... What is going on? Why is Finder reporting empty files as having 286 bytes?