Created
February 2, 2016 07:05
-
-
Save atomicpages/5332bac39e7c77101c46 to your computer and use it in GitHub Desktop.
Revisions
-
atomicpages created this gist
Feb 2, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ import java.util.Scanner; import java.io.PrintWriter; import java.io.File; public class Prog3b { public static void main(String[] args) { System.out.println("Program 3, Dennis Thompson, masc001"); if(args.length != 2) { System.err.println("Usage: java Prog3b infileName outfileName"); System.exit(1); } Scanner handle = null; PrintWriter out = null; try { handle = new Scanner(new File(args[0])); } catch(java.io.FileNotFoundException e) { System.err.println(e.getMessage()); System.exit(1); } try { out = new PrintWriter(System.getProperty("user.dir") + "/" + args[1], "UTF-8"); while(handle != null && handle.hasNextLine()) { out.println(handle.nextLine().replace(' ', ',')); } out.close(); } catch(java.io.IOException e) { System.err.println(e.getMessage()); System.exit(1); } finally { out.close(); handle.close(); } } }