Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
17
Task/File-size/Phix/file-size.phix
Normal file
17
Task/File-size/Phix/file-size.phix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function file_size(sequence file_name)
|
||||
object d = dir(file_name)
|
||||
if atom(d) or length(d)!=1 then return -1 end if
|
||||
return d[1][D_SIZE]
|
||||
end function
|
||||
|
||||
procedure test(sequence file_name)
|
||||
integer size = file_size(file_name)
|
||||
if size<0 then
|
||||
printf(1,"%s file does not exist.\n",{file_name})
|
||||
else
|
||||
printf(1,"%s size is %d.\n",{file_name,size})
|
||||
end if
|
||||
end procedure
|
||||
|
||||
test("input.txt") -- in the current working directory
|
||||
test("/input.txt") -- in the file system root
|
||||
Loading…
Add table
Add a link
Reference in a new issue