import java.io.*; /***************************************************************/ /* Inverzija vrstic brane datoteke */ /* Primer klica: java Inverzija */ /***************************************************************/ public class Inverzija { public static void main(String[] args) throws Exception { int c, i = -1; FileInputStream fin; char line[] = new char[80]; try { fin=new FileInputStream("Inverzija.java"); while ((c=fin.read())!=-1) { // beremo do konca datoteke if(c != '\n') line[++i] = (char) c; else { while(i>=0) System.out.print(line[i--]); System.out.println(); } } } catch (FileNotFoundException e) { System.out.println("Ne morem odpreti datoteke " + e.getMessage()); } } }