From: ts Date: 2004-07-25T18:04:45+09:00 Subject: Re: Get the content of a file >>>>> "D" == Dirk Einecke writes: D> Is there a shorter way to get the content of a file? svg% ri IO::read --------------------------------------------------------------- IO::read IO.read(rane, [length [, offset]] ) => string ------------------------------------------------------------------------ Opens the file, optionally seeks to the given offset, then returns _length_ bytes (defaulting to the rest of the file). +read+ ensures the file is closed before returning. IO.read("testfile") #=> "This is line one\nThis is line two\ nThis is line three\nAnd so on...\n" IO.read("testfile", 20) #=> "This is line one\nThi" IO.read("testfile", 20, 10) #=> "ne one\nThis is line " svg% Guy Decoux