langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,7 @@
let printFileSize filename =
let ic = open_in filename in
Printf.printf "%d\n" (in_channel_length ic);
close_in ic ;;
printFileSize "input.txt" ;;
printFileSize "/input.txt" ;;

View file

@ -0,0 +1,4 @@
let printLargeFileSize filename =
let ic = open_in filename in
Printf.printf "%Ld\n" (LargeFile.in_channel_length ic);
close_in ic ;;

View file

@ -0,0 +1,4 @@
#load "unix.cma" ;;
open Unix ;;
Printf.printf "%d\n" (stat "input.txt").st_size ;;
Printf.printf "%d\n" (stat "/input.txt").st_size ;;

View file

@ -0,0 +1,4 @@
use IO;
...
File("input.txt")->Size()->PrintLine();
File("c:\input.txt")->Size()->PrintLine();

View file

@ -0,0 +1,7 @@
NSFileManager *fm = [NSFileManager defaultManager];
// Pre-OS X 10.5
NSLog(@"%llu", [[fm fileAttributesAtPath:@"input.txt" traverseLink:YES] fileSize]);
// OS X 10.5+
NSLog(@"%llu", [[fm attributesOfItemAtPath:@"input.txt" error:NULL] fileSize]);

View file

@ -0,0 +1,5 @@
declare
[Path] = {Module.link ['x-oz://system/os/Path.ozf']}
in
{Show {Path.size "input.txt"}}
{Show {Path.size "/input.txt"}}

View file

@ -0,0 +1,26 @@
/* To obtain file size of files in root as well as from current directory. */
test: proc options (main);
declare ch character (1);
declare i fixed binary (31);
declare in1 file record;
/* Open a file in the root directory. */
open file (in1) title ('//asd.log,type(fixed),recsize(1)');
on endfile (in1) go to next1;
do i = 0 by 1;
read file (in1) into (ch);
end;
next1:
put skip list ('file size in root directory =' || trim(i));
close file (in1);
/* Open a file in the current dorectory. */
open file (in1) title ('/asd.txt,type(fixed),recsize(1)');
on endfile (in1) go to next2;
do i = 0 by 1;
read file (in1) into (ch);
end;
next2:
put skip list ('local file size=' || trim(i));
end test;

View file

@ -0,0 +1,2 @@
say 'input.txt'.IO.s;
say '/input.txt'.IO.s;

View file

@ -0,0 +1,6 @@
import Stdio;
int main(){
write(file_size("input.txt") + "\n");
write(file_size("/input.txt") + "\n");
}

View file

@ -0,0 +1,3 @@
;;; prints file size in bytes
sysfilesize('input.txt') =>
sysfilesize('/input.txt') =>

View file

@ -0,0 +1,4 @@
(input.txt ) print
(input.txt) status pop pop pop = pop
(/input.txt ) print
(/input.txt) status pop pop pop = pop

View file

@ -0,0 +1,2 @@
Get-ChildItem input.txt | Select-Object Name,Length
Get-ChildItem \input.txt | Select-Object Name,Length

View file

@ -0,0 +1,2 @@
Debug FileSize("input.txt")
Debug FileSize("/input.txt")

View file

@ -0,0 +1,4 @@
size? %info.txt
size? %/info.txt
size? ftp://username:password@ftp.site.com/info.txt
size? http://rosettacode.org

View file

@ -0,0 +1,12 @@
$INCLUDE "rapidq.inc"
DIM file AS QFileStream
FUNCTION fileSize(name$) AS Integer
file.Open(name$, fmOpenRead)
Result = file.Size
file.Close
END FUNCTION
PRINT "Size of input.txt is "; fileSize("input.txt")
PRINT "Size of \input.txt is "; fileSize("\input.txt")

View file

@ -0,0 +1,4 @@
FileName$ = DIR$("input.txt", 0)
PRINT "Size of input.txt is "; FileRec.Size
FileName$ = DIR$("\input.txt", 0)
PRINT "Size of \input.txt is "; FileRec.Size

View file

@ -0,0 +1,2 @@
'input.txt' status.size
'/input.txt' status.size

View file

@ -0,0 +1,3 @@
with files'
"input.txt" :R open &size sip close drop putn
"/input.txt" :R open &size sip close drop putn

View file

@ -0,0 +1,2 @@
with files'
"input.txt" :R open over 0 <> [ &size sip close drop ] ifTrue

View file

@ -0,0 +1,8 @@
with files'
: getFileSize ( $-n )
:R open 0 over =
[ "File does Not Exist\n" puts ]
[ &size sip close drop ] if ;
"input.txt" getFileSize putn
"/input.txt" getFileSize putn

View file

@ -0,0 +1,8 @@
print fileSize(DefaultDir$,"input.txt") ' current default directory
print fileSize("","input.txt") ' root directory
function fileSize(dir$,file$)
open dir$;"\";file$ FOR input as #f
fileSize = lof(#f) ' Length Of File
close #f
end function

View file

@ -0,0 +1,7 @@
$ include "seed7_05.s7i";
const proc: main is func
begin
writeln(fileSize("input.txt"));
writeln(fileSize("/input.txt"));
end func;

View file

@ -0,0 +1,2 @@
(File newNamed: 'input.txt') fileInfo fileSize.
(File newNamed: '/input.txt') fileInfo fileSize.

View file

@ -0,0 +1,2 @@
val size = OS.FileSys.fileSize "input.txt" ;;
val size = OS.FileSys.fileSize "/input.txt" ;

View file

@ -0,0 +1,11 @@
$$ MODE TUSCRIPT
-- size of file input.txt
file="input.txt"
ERROR/STOP OPEN (file,READ,-std-)
file_size=BYTES ("input.txt")
ERROR/STOP CLOSE (file)
-- size of file x:/input.txt
ERROR/STOP OPEN (file,READ,x)
file_size=BYTES (file)
ERROR/STOP CLOSE (file)

View file

@ -0,0 +1,2 @@
" input.txt" "R" file.open dup file.size . file.close
" /input.txt" "R" file.open dup file.size . file.close

View file

@ -0,0 +1,7 @@
[ "R" file.open
dup 0 <> [ dup file.size . file.close ] ifTrue
drop
] is display-size
" input.txt" display-size
" /input.txt" display-size

View file

@ -0,0 +1,10 @@
%File = new FileObject();
%File.openForRead("input.txt");
while(!%File.isEOF())
{
%Length += strLen(%File.readLine());
}
%File.close();
%File.delete();

View file

@ -0,0 +1 @@
fileSize("input.txt");

View file

@ -0,0 +1,2 @@
size1=$(ls -l input.txt | tr -s ' ' | cut -d ' ' -f 5)
size2=$(ls -l /input.txt | tr -s ' ' | cut -d ' ' -f 5)

View file

@ -0,0 +1,2 @@
size1=$(wc -c < input.txt | tr -d ' ')
size2=$(wc -c < /input.txt | tr -d ' ')

View file

@ -0,0 +1,2 @@
size1=$(stat -f %z input.txt)
size2=$(stat -f %z /input.txt)

View file

@ -0,0 +1,5 @@
# from module 'zsh/stat', load builtin 'zstat'
zmodload -F zsh/stat b:zstat
size1=$(zstat +size input.txt)
size2=$(zstat +size /input.txt)

View file

@ -0,0 +1,2 @@
Num_Type(File_Size("input.txt"))
Num_Type(File_Size("/input.txt"))

View file

@ -0,0 +1,5 @@
Dim local As New IO.FileInfo("input.txt")
Console.WriteLine(local.Length)
Dim root As New IO.FileInfo("\input.txt")
Console.WriteLine(root.Length)