Java ใช้ในการเขียน file และ อ่าน file นะครับ
import java.io.*;
class Test {
static public void main(String[] args) throws Exception {
System.out.println("Go radiusd -X...");
Runtime rt = Runtime.getRuntime();
Process ps = rt.exec("radiusd -X");
BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
FileOutputStream fos = new FileOutputStream("radius.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
FileOutputStream fof = new FileOutputStream("file.txt");
ObjectOutputStream oof = new ObjectOutputStream(fof);
String line = null;
int count = 0;
while (true) {
line= br.readLine();
if (line == null) break;
count++;
oos.writeUTF(count+ " " +line + "\n");
System.out.println(line);
String st = new String(line);
}
}
}
ขอขอบคุณ จุ่ย ที่ช่วยแนะนำ
************* The End *********************
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment