开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜