File size: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
mNo edit summary |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 214:
return 0;
}</lang>
=={{header|C sharp|C#}}==▼
<lang csharp>using System;▼
using System.IO;▼
class Program▼
{▼
static void Main(string[] args)▼
{▼
Console.WriteLine(new FileInfo("/input.txt").Length);▼
Console.WriteLine(new FileInfo("input.txt").Length);▼
}▼
}▼
</lang>▼
=={{header|C++}}==
Line 242 ⟶ 257:
<< std::ifstream("/input.txt", std::ios::binary | std::ios::ate).tellg() << "\n";
}</lang>
▲=={{header|C sharp|C#}}==
▲<lang csharp>using System;
▲using System.IO;
▲class Program
▲{
▲ static void Main(string[] args)
▲ {
▲ Console.WriteLine(new FileInfo("/input.txt").Length);
▲ Console.WriteLine(new FileInfo("input.txt").Length);
▲ }
▲}
▲</lang>
=={{header|Clean}}==
Line 505:
test("input.txt") -- in the current working directory
test("/input.txt") -- in the file system root</lang>
=={{header|F_Sharp|F#}}==▼
<lang fsharp>open NUnit.Framework▼
open FsUnit▼
[<Test>]▼
let ``Validate that the size of the two files is the same`` () =▼
let local = System.IO.FileInfo(__SOURCE_DIRECTORY__ + "\input.txt")▼
let root = System.IO.FileInfo(System.IO.Directory.GetDirectoryRoot(__SOURCE_DIRECTORY__) + "input.txt")▼
local.Length = root.Length |> should be True</lang>▼
=={{header|Factor}}==
Line 579 ⟶ 590:
Print FileLen("input.txt"), FileLen(Environ("SystemRoot") + "\input.txt")
Sleep</lang>
▲=={{header|F_Sharp|F#}}==
▲<lang fsharp>open NUnit.Framework
▲open FsUnit
▲[<Test>]
▲let ``Validate that the size of the two files is the same`` () =
▲ let local = System.IO.FileInfo(__SOURCE_DIRECTORY__ + "\input.txt")
▲ let root = System.IO.FileInfo(System.IO.Directory.GetDirectoryRoot(__SOURCE_DIRECTORY__) + "input.txt")
▲ local.Length = root.Length |> should be True</lang>
=={{header|Gambas}}==
Line 902:
echo getFileSize "input.txt"
echo getFileSize "/input.txt"</lang>
=={{header|Objeck}}==▼
<lang objeck>▼
use IO;▼
...▼
File("input.txt")->Size()->PrintLine();▼
File("c:\input.txt")->Size()->PrintLine();▼
</lang>▼
=={{header|Objective-C}}==
Line 912 ⟶ 920:
// OS X 10.5+
NSLog(@"%llu", [[fm attributesOfItemAtPath:@"input.txt" error:NULL] fileSize]);</lang>
▲=={{header|Objeck}}==
▲<lang objeck>
▲use IO;
▲...
▲File("input.txt")->Size()->PrintLine();
▲File("c:\input.txt")->Size()->PrintLine();
▲</lang>
=={{header|OCaml}}==
Line 999:
<lang perl>my $size1 = (stat 'input.txt')[7]; # builtin stat() returns an array with file size at index 7
my $size2 = (stat '/input.txt')[7];</lang>
=={{header|Perl 6}}==▼
{{works with|Rakudo|2015.12}}▼
<lang perl6>say 'input.txt'.IO.s;▼
say '/input.txt'.IO.s;</lang>▼
Cross-platform version of the second one:▼
<lang perl6>say $*SPEC.rootdir.IO.child("input.txt").s;</lang>▼
=={{header|Phix}}==
Line 1,120 ⟶ 1,112:
(file-size "input.txt")
(file-size "/input.txt")</lang>
(formerly Perl 6)
▲{{works with|Rakudo|2015.12}}
▲<lang perl6>say 'input.txt'.IO.s;
▲say '/input.txt'.IO.s;</lang>
▲Cross-platform version of the second one:
▲<lang perl6>say $*SPEC.rootdir.IO.child("input.txt").s;</lang>
=={{header|RapidQ}}==
Line 1,155 ⟶ 1,156:
size? ftp://username:password@ftp.site.com/info.txt
size? http://rosettacode.org</lang>
=={{header|Red}}==
<lang Red>>> size? %input.txt
|