由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Re: how to write a string to a new file
相关主题
How to append something on a file?java servlet question
[转载] Java 1.5 Generic 问题which one should I close?
Can someone help on Soap?sevlet question
An interesting thing about java generics-do not laugh at me if u think it too basic问一个blocking IO的程序
怎麼得到字符串中的raw bytes?java问题:如何match两个正规表达式
一道 JAVA Stack vs Heap 题java string stream
Java 问题出个简单题,看你Java APi熟悉到什么程度
一个Java程序员的话(4)--续第一章ask a question about C
相关话题的讨论汇总
话题: string话题: dos话题: new话题: file
进入Java版参与讨论
1 (共1页)
z****u
发帖数: 15
1

You are not using the right classes. In JDK1.1 and later,
use
PrintWriter dos = new PrintWriter( new
FileWriter("file.txt"));
dos.println("a string here");
why do you think it is NOT simple?
In C:
FILE dos = fopen("file.txt", "w");
fprint(dos, "a string here\n");
In C++
ofstream dos = new ofstream("file.txt");
dos << "a string here" << endl;
same logic, same approach
1 (共1页)
进入Java版参与讨论
相关主题
ask a question about C怎麼得到字符串中的raw bytes?
Re: How to creat a newinstance with a param??一道 JAVA Stack vs Heap 题
折腾了一天,实在是绝望了,请教请教Java 问题
Re: Java中如何动态生成对象(Yuns的解释)一个Java程序员的话(4)--续第一章
How to append something on a file?java servlet question
[转载] Java 1.5 Generic 问题which one should I close?
Can someone help on Soap?sevlet question
An interesting thing about java generics-do not laugh at me if u think it too basic问一个blocking IO的程序
相关话题的讨论汇总
话题: string话题: dos话题: new话题: file