How to resolve the algorithm Check that file exists step by step in the i programming language

Published on 12 May 2024 09:40 PM
#I

How to resolve the algorithm Check that file exists step by step in the i programming language

Table of Contents

Problem Statement

Verify that a file called     input.txt     and   a directory called     docs     exist.

This should be done twice:

Optional criteria (May 2015):   verify it works with:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Check that file exists step by step in the i programming language

Source code in the i programming language

concept exists(path) {
	open(path)
	errors {
		if error.DoesNotExist()
			print(path, " does not exist!")
		end
		return
	}
	print(path, " exists!")
}

software {
	exists("input.txt")
	exists("/input.txt")
	exists("docs")
	exists("/docs")
	exists("docs/Abdu'l-Bahá.txt")
}

  

You may also check:How to resolve the algorithm File input/output step by step in the Pascal programming language
You may also check:How to resolve the algorithm Read a file character by character/UTF8 step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Sorting algorithms/Heapsort step by step in the CoffeeScript programming language
You may also check:How to resolve the algorithm Old Russian measure of length step by step in the Raku programming language
You may also check:How to resolve the algorithm Count occurrences of a substring step by step in the Pascal programming language