How to resolve the algorithm File size step by step in the Clean programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm File size step by step in the Clean programming language
Table of Contents
Problem Statement
Verify the size of a file called input.txt for a file in the current working directory, and another one in the file system root.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm File size step by step in the Clean programming language
Source code in the clean programming language
import StdEnv
fileSize fileName world
# (ok, file, world) = fopen fileName FReadData world
| not ok = abort "Cannot open file"
# (ok, file) = fseek file 0 FSeekEnd
| not ok = abort "Cannot seek file"
# (size, file) = fposition file
(_, world) = fclose file world
= (size, world)
Start world = fileSize "input.txt" world
You may also check:How to resolve the algorithm Integer comparison step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Hofstadter Q sequence step by step in the Haskell programming language
You may also check:How to resolve the algorithm Sierpinski arrowhead curve step by step in the jq programming language
You may also check:How to resolve the algorithm Commatizing numbers step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm CRC-32 step by step in the Nim programming language