How to resolve the algorithm File size step by step in the Common Lisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm File size step by step in the Common Lisp 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 Common Lisp programming language

Source code in the common programming language

(with-open-file (stream (make-pathname :name "input.txt")
                 :direction :input
                 :if-does-not-exist nil)
  (print (if stream (file-length stream) 0)))
  
(with-open-file (stream (make-pathname :directory '(:absolute "") :name "input.txt")
                 :direction :input
                 :if-does-not-exist nil)
  (print (if stream (file-length stream) 0)))


  

You may also check:How to resolve the algorithm Terminal control/Dimensions step by step in the Julia programming language
You may also check:How to resolve the algorithm Hello world/Newline omission step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm Sudoku step by step in the J programming language
You may also check:How to resolve the algorithm Harshad or Niven series step by step in the Go programming language
You may also check:How to resolve the algorithm Parametric polymorphism step by step in the Clean programming language