tags:

views:

21

answers:

1

Simple

How can I get a list of the files that are inside directory using eiffel?

A: 

For example:


class CARPETAS

creation
    make

feature {NONE}

    make is
      local
          directory: DIRECTORY
          path: STRING
      do
          path := "." -- Current directory
          !!directory.scan_with(path)
          list_directory(directory)
      end

    list_directory(directory: DIRECTORY) is
      local
          i: INTEGER
      do
          std_output.put_string("Content of " + directory.path + "%N")
          from
              i := directory.lower
          until
              i > directory.upper
          loop
              std_output.put_string("%T" + directory.name(i) + "%N")
              i := i + 1
          end
      end
end

Eiffel is really elegant.

enriqueM