java - What happens when writing to aux file on Windows? -
i have following code:
public class mytest { public static void main(string [] args) throws exception { java.io.file f = new java.io.file("aux.txt"); f.createnewfile(); java.io.filewriter fw = new java.io.filewriter(f); fw.write("hello"); fw.flush(); fw.close(); } }
the code runs , not throw exception. except: file aux.txt not there. found f.createnewfile()
return false, because aux file not allowed created on windows. ok, can live that.
but, confusion this: if filewriter
did not throw exception, did write to?
according msdn
do not use following reserved names name of file: con, prn, aux, nul, com1, com2, com3, com4, com5, com6, com7, com8, com9, lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8, , lpt9. avoid these names followed extension; example, nul.txt not recommended.
false
returned means, file exists. according this blog writing aux
on windows
causes writing auxiliary device, serial port.
in addition, try writing file called con
. should appear in console.
Comments
Post a Comment