From: Mark Hubbart Date: 2004-03-25T06:50:00+09:00 Subject: Re: File.stat.size errors with file sizes over 2Gigs. On Mar 24, 2004, at 1:29 PM, walter@mwsewall.com wrote: > > >> It looks like a bug (that is, it doesn't happen that way on my > box). > > Is it a windows or *nix box? and can you read files over 4 gigs in > size? It's a mac, so it's a *nix box. > >> I'm guessing that it's a signed unsigned integer problem. When it >> wraps around, does it start out at negative one and go upward fro >> increasing file sizes? >> >>> Is there a work around? >> >> try: >> [File.stat("filename").size].pack("i").unpack("I") >> > > Thats cool and does work for files less than 4 gigs but (obviously) > fails for larger files. whoops :/ I didn't think about that until I read your followup posting where you said 14 gigs... Okay, new workaround! :) Open in append mode, read the position. >> File.open("/Users/mark/bigfile","a"){|f|f.pos} => 12006195200 Does that work? --Mark