How to resolve the algorithm Create a file step by step in the Nim programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Create a file step by step in the Nim programming language
Table of Contents
Problem Statement
In this task, the job is to create a new empty file called "output.txt" of size 0 bytes and an empty directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Create a file step by step in the Nim programming language
Source code in the nim programming language
import os
open("output.txt", fmWrite).close()
createDir("docs")
open(DirSep & "output.txt", fmWrite).close()
createDir(DirSep & "docs")
import os
const directories = ["/", "./"]
for directory in directories:
open(directory & "output.txt", fmWrite).close()
createDir(directory & "docs")
You may also check:How to resolve the algorithm Hello world/Text step by step in the Nit programming language
You may also check:How to resolve the algorithm General FizzBuzz step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm Magic constant step by step in the Arturo programming language
You may also check:How to resolve the algorithm Stack step by step in the Ruby programming language
You may also check:How to resolve the algorithm Loop over multiple arrays simultaneously step by step in the Ursala programming language