I'm not yet fully up to speed with the logic of how to write to a text file.
The program that I am trying to write will save a whole list of chars and their ASCII value (value up to 1000). I want to save the output to a text file as it has unicode so I will be able to see what the symbols are (when eclipse returns the values the symbols show as a ?).
Would any1 be able to suggest to me a link to visit to read up on this or are there any suggestions as to what I should do?
[here is my code]
package testPackage;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.Charset;
public class CharListLoopToTxt
{
public static void main(String[] args)
{
for(int i = 0; i<1000; i++)
{
char charLoop;
charLoop = (char) i;
BigDecimal rr = new BigDecimal(charLoop);
Charset charset = Charset.forName("US-ASCII");
String s = "";
try (BufferedWriter writer = Files.newBufferedWriter(file, charset))
{
writer.write(s, 0, s.length());
}
System.out.println(rr +" is the ASCII value for "+ charLoop);
}
}
}
Again I am not yet fully up to speed with the logic of how to write to a text file so just bear that in mind :p