aboutsummaryrefslogtreecommitdiff
path: root/CS2452/assign2/src/P1.java
diff options
context:
space:
mode:
Diffstat (limited to 'CS2452/assign2/src/P1.java')
-rw-r--r--CS2452/assign2/src/P1.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/CS2452/assign2/src/P1.java b/CS2452/assign2/src/P1.java
new file mode 100644
index 0000000..3580cf9
--- /dev/null
+++ b/CS2452/assign2/src/P1.java
@@ -0,0 +1,39 @@
+import java.io.*;
+
+class P1
+{
+
+ public static void main(String[] args)
+ {
+ String str = null;
+ BufferedReader br;
+ br = new BufferedReader(new InputStreamReader(System.in));
+ BufferedWriter bw = null;
+
+ try
+ {
+ File file = new File(args[0]);
+
+ if (! file.exists())
+ {
+ file.createNewFile();
+ }
+
+ bw = new BufferedWriter(new FileWriter(file));
+ while(true)
+ {
+ str = br.readLine();
+ bw.write(str);
+ bw.newLine();
+ bw.flush();
+ }
+ } catch(Exception e)
+ {
+ System.out.printf("Unable to write to file %s\n", args[0]);
+ }
+
+
+
+
+ }
+}