From: HarryO Date: 2001-11-20T14:11:36+09:00 Subject: [ruby-talk:25890] File access modes I wanted to write some code that would update a counter stored in a file. The following code works just fine ... File.open("counter", File::CREAT | File::RDWR) do |f| f.flock(File::LOCK_EX) count = f.gets.to_i f.rewind f.puts count + 1 end .... but I orginally wrote the File.open() as ... File.open("counter", "w+") and the f.gets seemed to return an empty string every time, irrespective of whether the file already existed, and even if I put an extra f.rewind before it (although, I thought that was redundant). Is there a string-style mode that's equivalent to the specific mode flags I've use above?