java - Writing to Files : Printwriter Converting Forward Slash to Backslash -


Why are doing this Printwriter?

  file file = new file ("/ files / kattextext"); Author = new printritter (file); Writer.write ("hello");  

I get an error in the code above which says:

  java.io.FileNotFoundException: \ files \ KA.txt (the network path was Not found)  

This was not my specified path? Then how do I specify a file to write - usually create a new file and write it on? It also throws errors if KA.txt does not exist - I want to make it a new file and author.

Thanks

I ideally create a new file and author

You can create just one file,

  PrintWriter author = new Print Writer ("name.txt", "UTF-8") ; Author.println ("text");  

Where UTF-8 is file encoding. And write the file, remember that the file exists with the same name, then this override


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -