我正在將我的變量寫入CSV文件,但我面臨以下兩個問題 - 1.即使腳本結束,CSV文件也會顯示它正在使用並且只讀模式 2.我想要製表符分隔值,但\ t在以下不起作用Jmeter寫入文件-Beanshell腳本問題
FileWriter fstream = new FileWriter("C:\\path to csv\\test.csv",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(vars.get("num1"));
out.write(System.getProperty("\t"));
out.write(vars.get("num2"));
out.write(System.getProperty("line.separator"));
out.close();
fstream.close();
我該如何解決它們?
out.write(「\ t」);不工作。所以我嘗試了下面的代碼,但它沒有寫入任何csv文件 - import java.io.FileOutputStream; import java.io.BufferedWriter; import java.io.FileWriter; line_num1 = vars.get(「line_num」); log.info(「number is」+ line_num1); FileWriter fstream = new FileWriter(「C:\\ Users \\ 5CB4024KNM \\ Desktop \\ MOBI \\ mobi \\ r.csv」,true); BufferedWriter out = new BufferedWriter(fstream); out.write(vars.get(「line_num」)); out.write(System.getProperty(「line.separator」)); out.close(); fstream.close(); – arm