Hello,
I have been trying to create some program that reads from the text file and inserts 3 spaces at the beginning of each new paragraph and finally outputs the result to another text file.
Please help:
import java.io.*;
public class Paragraphs {
public static void main(
String[] args) throws IOException {
// create read and write files
File inputFile = new File("hi.dat");
File outputFile = new File("d.out");
// create two File Streams
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
// read file and write it to another
int b;
while ((b = in.read()) != -1)
out.write(b);
// close files
in.close();
out.close();
}
}