The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


File Handling

Posted by Hiran Watson on July 12, 2001 at 11:14 PM

Hey, I have a question on opening, and writing to and reading from files. Whenever I try to open a file using the File class, it doesn't work. I use the constructor File(String name), where name is a pathname. But I keep getting a compiler error if I use a pathname that extends beyond the c drive. (Ex. "c:\test.txt" will work, but "c:\windows\test.txt" gives me an error). Secondly, even if I use the pathname "c:\test.txt", and place the text file under the root directory ("c:\"), I get the output that the File Is Not Found. Does anyone know what am I doing wrong. Also, how do you determine the length of a file. I need this to be able to deal with files in binary mode. If you want I can email you my code, and you can check to see what is going wrong, just give me a shout on my address. Thanx for the help!

  • n/a skyyoung July 12, 2001 at 11:34 PM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us