PrintWriter & createWriter
in
Programming Questions
•
2 years ago
I was wondering if someone could help me with this as it's driving me nuts, I am trying to read a list of values from one file and write it to another as part of a larger project, here is my simplified code:
PrintWriter commits;
void setup() {
commits = createWriter("commits.txt");
String[] data = loadStrings("export.txt");
for (int i = 0; i < data.length; i++) {
commits.println(data);
}
commits.flush();
commits.close();
println("done");
}
which is all fine until I look at the output file which just contains repeated lines of this:
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
The export.txt is just a list of names and emails and prints ok to the console, I haven't a clue what's going on..
Thanks
PrintWriter commits;
void setup() {
commits = createWriter("commits.txt");
String[] data = loadStrings("export.txt");
for (int i = 0; i < data.length; i++) {
commits.println(data);
}
commits.flush();
commits.close();
println("done");
}
which is all fine until I look at the output file which just contains repeated lines of this:
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
[Ljava.lang.String;@1556d12
The export.txt is just a list of names and emails and prints ok to the console, I haven't a clue what's going on..
Thanks
1