• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed in file reading.

 
Varun Goenka
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FileReader var1 = new FileReader("anthony gonsalves.txt");

Lets just consider the case of anthony gonsalves.txt not being in the same folder as the Java app.

How does one code then?
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what error do you get when the .txt file is not there?
 
Varun Goenka
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
illegal escape character
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FileReader var1 = new FileReader("anthony gonsalves.txt");

that should get a file not found exception.

if you are getting illegal escape character, that makes me think you are really trying something like "C:\files\anthony\ gonzalves.txt"

instead you want "C:\\files\\anthony gozalves.txt"

can you post your actual code ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!