java: openCSV not writing to file in recursive loop?
in my main class
public static void main(String[] args) {
CSVWriter writer = new CSVWriter(new FileWriter("D:\\myfilefile.csv"), '\t');
recursiveLoop(writer, 10);
}
public void function recursive(CSVWriter writer, int index){
if (index == 0){
return;
}else{
String[] entries ="TEST#LINE#".split("#");
wri开发者_StackOverflowter.writeNext(entries);
index--;
recursiveLoop(writer, index);
}
}
howeverwhen I open my file.csv, nothing is written ! What am I doing wrong ?
Try to call writer.flush() at the end
精彩评论