使用这种方式,当指定的文件不存在时会自动创建。
//此处设置为true即可追加 FileWriter out = new FileWriter("D:\\1.txt",true); //往文件写入 out.write("abc"); //换行 out.write("\r\n"); //继续追加 out.write("def"); //刷新IO内存流 out.flush(); //关闭 out.close();
使用这种方式,当指定的文件不存在时会自动创建。
//此处设置为true即可追加 FileWriter out = new FileWriter("D:\\1.txt",true); //往文件写入 out.write("abc"); //换行 out.write("\r\n"); //继续追加 out.write("def"); //刷新IO内存流 out.flush(); //关闭 out.close();
上一篇:Linux根文件系统的制作
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M