[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

File.length() returns zero?

Dear Experts,

I'm doing:

  File file = new File("c://junk//session.txt");  
  long byteSize = file.length();
  System.out.println("bytes:" + byteSize);

and it's always returning zero.  The file exists, and has stuff in it.  Any ideas?  I've tried it with big and small files.  I'm on W2K if that matters...

Thanks,
BrianMc1958
0
BrianMc1958
Asked:
BrianMc1958
  • 2
1 Solution
 
CEHJCommented:
Try

File file = new File("c:/junk/session.txt");  
0
 
BrianMc1958Author Commented:
That works.  It's the damn slash/backslash//escapesequence///!@%$^#&* again...

Thanks.
0
 
CEHJCommented:
:-)

Yes - you don't need to double forward slashes - only backward ones ;-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now