Difference between revisions of "Determine the size of a file"

From CodeCodex

 
(Added common lisp implementation)
Line 1: Line 1:
 
==Implementations==
 
==Implementations==
 +
===Common Lisp===
 +
Quite easy with Common Lisp:
 +
<pre>
 +
> (with-open-file (file "output.swf") (file-length file))
 +
193842
 +
</pre>
 +
 
===Java===
 
===Java===
 
<pre>
 
<pre>

Revision as of 22:30, 16 December 2006

Implementations

Common Lisp

Quite easy with Common Lisp:

> (with-open-file (file "output.swf") (file-length file))
193842

Java

    File file = new File("infilename");
    
    // Get the number of bytes in the file
    long length = file.length();