Pastey filesize error
- Posted by useless_
Nov 30, 2012
--
--- build a file over 2^32 bytes as a test
--
-- in this case, readfile is 2.6 gigabytes, so read once,
-- write twice should give a 5.2Gbyte file......
include std/filesys.e -- for dir()
include std/console.e -- any_key
puts(1,"running\n")
object readfile = open("D:\\ngrams\\Co-5grams.txt","rb")
object writefile = open("D:\\ngrams\\bigfile.txt","ab")
object readline = ""
readline = gets(readfile)
while not equal(readline,-1) do
puts(writefile,readline) -- it should still have the \n on it as read
puts(writefile,readline) -- it should still have the \n on it as read
readline = gets(readfile)
end while
close(readfile)
readline = dir("D:\\ngrams\\bigfile.txt")
readline = sprintf("%d",readline[1][3])
puts(1,"Before closing: "&readline&"\n")
close(writefile)
readline = dir("D:\\ngrams\\bigfile.txt")
readline = sprintf("%d",readline[1][3])
puts(1,"After closing: "&readline&"\n")
any_key("Press Any Key to quit"