theres more to the method than that but not much more
|
why dosent this work?
it just dosent write anything to the file. no exception or anything.Code:public void writeToFile(String str, String file) { try { BufferedWriter bw = null; bw = new BufferedWriter(new FileWriter(file)); bw.write(str); } catch(Exception exx) { System.out.println("could not write");} }
whats missing..?
Cores Ban Command Log Method
In client.java you need to declareCode:public void writeLog(String data, String file) { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter("bin/data/" + file + ".txt",true)); bw.write(data); bw.newLine(); bw.flush(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (bw != null) try { bw.close(); } catch (IOException ioe2) { System.out.println("Error writing system log."); ioe2.printStackTrace(); } } }
http://www.rune-server.org/showthrea...68#post1033168Code:import java.io.BufferedWriter; import java.io.IOException;
You should be able to figure it out from that...
ok like it deletes whats already in the file... im making logs, so how do i make it not delete whats already there?
that method overwrites the file. im making a chat log and it only puts the last line typed in there.
Code:bw.newLine(); bw.flush();
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |