Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

thefil

macrumors newbie
Original poster
Jun 11, 2007
27
0
I'm coming from a Windows environment and I have a bit of a file input problem...

Code:
glass = new Scanner( new File("\Users\filipkrynicki\Mydia 4.0\build\classes\mydia40\db.m4"));

returns an error "illegal escape character"

*edit* I fixed that problem by doubling the \\s, but now it can't find the file. Am I doing something wrong?
 

itickings

macrumors 6502a
Apr 14, 2007
947
185
My guess would be the use of \ instead of /.

To avoid this kind of problem, consider using File.separator instead of assuming a specific separator.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
My guess would be the use of \ instead of /.

To avoid this kind of problem, consider using File.separator instead of assuming a specific separator.

Totally correct \ is only the Windows separator, / is used by OS X/Unix/Linux. To run it on both the System Property File.separator is the way to go.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.