Check whether a file is empty.

vino vino.bheeman at hotmail.com
Fri Dec 8 19:13:20 UTC 2017


On Friday, 8 December 2017 at 12:25:19 UTC, FreeSlave wrote:
> On Friday, 8 December 2017 at 09:40:18 UTC, Vino wrote:
>> Hi All,
>>
>>   Request your help on how to check whether a given file is 
>> empty, I tried the getSize from std.file but no luck as in 
>> windows 7 is the file is empty the size of the file is 0 bytes 
>> but in Windows 2003 if the file is empty the size of the file 
>> show as 2 bytes.
>>
>>
>> From,
>> Vino.B
>
> Was it the same file on Windows 7 and Windows 2003?
> Maybe the file on Windows 2003 had a byte order mark or 
> carriage return + newline characters.

Hi,

  The code is same just copy pasted the code form Windows 7 into 
Windows 2003 and executed, in Windows 7 the log file is of size 0 
where as in windows 2003 the log file is of size 2 byte where the 
log file in both the server is empty.

From,
Vino.B


More information about the Digitalmars-d-learn mailing list