Topic: 有关文件输入输出的一题!!

  Print this page

1.有关文件输入输出的一题!! Copy to clipboard
Posted by: bullyyd
Posted on: 2003-04-10 10:33

OutputStream os= new FileOutputStream (“file.txt”, true);
DataOutputStream out = new DataOutputStream(os);
out.writeBytes (“<end>/n”);
请问这个代码中 FileOutputStream (“file.txt”, true);
true是什么意思?
谢谢!!

2.Re:有关文件输入输出的一题!! [Re: bullyyd] Copy to clipboard
Posted by: lixj0571
Posted on: 2003-04-11 09:27

public FileOutputStream(String name,boolean append)
throws FileNotFoundExceptionf

the second argument is true, then bytes will be written to the end of the file rather than the beginning.

3.Re:有关文件输入输出的一题!! [Re: bullyyd] Copy to clipboard
Posted by: Janas
Posted on: 2003-04-14 15:25

FileOutputStream (“file.txt”, true);
如果 file.txt 已经存在那就会把新的字符接在后面, 而不会将旧的档案资料清除。如果file.txt 不存才会建立一个新档.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923