We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Unexpected char:'D' when using File()
Page Index Toggle Pages: 1
Unexpected char:'D' when using File() (Read 943 times)
Unexpected char:'D' when using File()
May 18th, 2008, 1:15am
 
Hi

I'm writting one of the sample projects from "Visualizing Data", and there is one line which keeps it from compiling:

   File rootFile = new File("C:\Documents and Settings\0\My Documents\processing-0135-expert");

I get the error: Unexpected char:'D', by playing with I realized this is the first char in the string. I copied this from the windows explorer so I thought that maybe some unprintable characters are in there, but that doesn't seem to be case as I retyped the string by hand.
Also googled this quickly but haven't been lucky.

Any ideas what this could be

Re: Unexpected char:'D' when using File()
Reply #1 - May 18th, 2008, 2:39am
 
hi,
it should be C:\\..
explorer hides this from you.

have fun, frank.
Re: Unexpected char:'D' when using File()
Reply #2 - May 18th, 2008, 9:40am
 
'\' is the escape character in Java, it means that the next character is a special one and shouldn't be taken literally, e.g. \n means "New line", so to have an actual \ they all need to be \\
Re: Unexpected char:'D' when using File()
Reply #3 - May 19th, 2008, 2:00am
 
Thanks that worked!
Page Index Toggle Pages: 1