...nothing wrapped in mystery
In short, file handling is very usefull if you're writing a lot of lines at once. To circumscribe the difference of /write and /fwrite:
Each /write command "accesses" the file in question, performs the file manipulation and "releases" the file right after (for example, the file can be accessed by other apps again).
Using the file handling method, your mIRC is getting "access" to the file via /fopen, then you perform as many /fwrite operations as you like, and finally you "release" the file via /fclose (Maybe someone else can depict the difference more precise...).
To demonstrate the different performance:
; /test.write <N>
; = while loop performing N /write
alias test.write {
var %n = 1, %start = $ticks
while (%n <= $1) {
write test.txt <This is a test text>
inc %n
}
ECHO -ag wrote $lines(test.txt) lines via write, this took $calc($ticks - %start) ticks.
.remove test.txt
}
; /test.fwrite <N>
; = while loop performing N /fwrite
alias test.fwrite {
var %n = 1, %start = $ticks
.fopen -o testfile test.txt
while (%n <= $1) {
.fwrite -n testfile <This is a test text>
inc %n
}
.fclose testfile
ECHO -ag wrote $lines(test.txt) lines via fwrite, this took $calc($ticks - %start) ticks.
.remove test.txt
}
If you put a high number, e.g. 5000, it's as different as day and night (on my system it's 20x faster).
