Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

TYPE leaves the file open

May
12,949
172
I'm probably not supposed to TYPE a 4GB binary file, but I tried to do so, redirecting output to NUL, and found that the file was left open. I was trying to get Windows to cache the file.

Code:
d:\projects2022\crc32\x64\release> d 4g
2024-01-08  23:07   4,294,967,296  4g

d:\projects2022\crc32\x64\release> filelock 4g

d:\projects2022\crc32\x64\release> type 4g > nul
d:\projects2022\crc32\x64\release> filelock 4g
 8924  D:\tc31\tcc.exe
 
Is that also the case with cmd type?
No. I only tried once. And I figure CMD actually did it (judging by how much time it took, 66 sec). TCC fails the first time in 4 sec. and, on subsequent tries, immediately.
 
I wann't asking that it handle > 4Gb files, only suggesting that it didn't leave them locked when it fails.
 
It's the RTL doing that, not my code. I will have to rewrite a couple of the RTL functions, so probably 200-300 lines of code. Since nobody had noticed it for the last 30 years, it won't get a very high priority for an immediate fix.

You can request it in the Suggestions Forum.
 

Similar threads

Back
Top