6 Replies Latest reply on Mar 25, 2008 7:44 PM by 807601

    Need help in text file reading and saving to another..

    807601
      Hello,
      I have design a method work like a language stemmer called root "this will give you the original word without any additional prefixes or suffixes..
      Now I have two text files, the first text will be the input file containing some words, and the second will be the output file contains the stemmed words..
      My problem is in connecting the two files, i need a code in main method that reads the input file and write the output to another file using the method "root"..

      see this code"the problem, to explain my question only" and tell me what is the write way to do it please:

      {code}public static void main(String[] args) throws Exception{

      Scanner freader = new Scanner("d:\\input.txt");
      BufferedWriter writer = new BufferedWriter(new FileWriter("d:\\output.txt"));


      String line = null;
      while (freader.hasNextLine()) {
      line = freader.nextLine();
      writer.println(root(freader.next()));
      }

      //... Close reader and writer.
      freader.close(); // Close to unlock.
      writer.close(); // Close to unlock and flush to disk.
      }{code}

      thank you,

      Edited by: realahmed8 on Mar 25, 2008 6:02 AM

      Edited by: realahmed8 on Mar 25, 2008 6:04 AM