The following sequence would appear to be a bug:
*** START ***
//echo -a $exists(test.txt)
-> $false
/fopen -n TEST test.txt
-> * fopen created 'TEST' (F:\MIRC611\test.txt)
/fclose TEST
-> * fclose closed 'TEST' (F:\MIRC611\test.txt)
//echo -a $exists(test.txt)
-> $true
/fopen -n TEST test.txt
-> * fopen unable to create 'TEST' (F:\MIRC611\test.txt)
//echo -a $ferr
--> 1
//fwrite -n TEST test test test
--> * fwrite error writing to 'TEST'
/fclose TEST
-> * fclose closed 'TEST' (F:\MIRC611\test.txt)
*** END ***
According to the docs, "The -n switch creates the file if it doesn't already exist." This would suggest to me that it either opens it (if it exists) or it creates it (if it doesn't) - much as a POSIX standard interface would.
(This also appears to have been the assumption on a previous
bug report ...)
(I'm using mIRC 6.12)