Why doesn't it work?

by Creative Bachkhoa (modified: 2009 Nov 23)

I start using I/O in eiffel, and my first program doesn't work.


make local input : PLAIN_TEXT_FILE output : PLAIN_TEXT_FILE internal : ARRAY[CHARACTER] i, j : INTEGER do io.putstring ("Welcome to file-io land! %N") create input.make_open_read ("C:\eiffel\test1.txt") io.put_string ("STOP") create output.make_open_write("C:\eiffel\test1_copy.txt") create internal.make(1,1000) from input.start ; input.read_character ; i := 0 until input.off loop io.putchar(input.last_character) i := i + 1 internal.put(input.last_character,i) input.read_character end input.close io.putstring("%N%NCopy from array%N%N") from j := 0 until j = i loop j := j + 1 output.putchar(internal @ j) end output.close io.putstring("Done.") end Could anybody explain this to me?

Comments
  • Helmut Brandl (15 years ago 24/11/2009)

    What do you mean by: It doesn't work.

    By the way: The array access method of a @ i is obsolete. Better use a[i].

  • Jocelyn-Fiat (15 years ago 4/12/2009)

    Message to "Creative Bachkhoa" Without answer from you, we will remove this article. And such post should be posted to forum.eiffel.com instead of this "article" channel.