How to resolve the algorithm Create a file step by step in the Smalltalk programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Create a file step by step in the Smalltalk 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 Smalltalk programming language

Source code in the smalltalk programming language

(FileDirectory on: 'c:\') newFileNamed: 'output.txt'; createDirectory: 'docs'.


ws := (File name: 'output.txt') writeStream.
ws close.
Directory create: 'docs'.

ws := (File name: '/output.txt') writeStream.
ws close.
Directory create: '/docs'.


  

You may also check:How to resolve the algorithm Goldbach's comet step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Zsigmondy numbers step by step in the Perl programming language
You may also check:How to resolve the algorithm Percolation/Site percolation step by step in the Java programming language
You may also check:How to resolve the algorithm Truncatable primes step by step in the Bracmat programming language
You may also check:How to resolve the algorithm Sorting algorithms/Gnome sort step by step in the 360 Assembly programming language