How to resolve the algorithm File modification time step by step in the Icon and Unicon programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm File modification time step by step in the Icon and Unicon programming language

Table of Contents

Problem Statement

Get and set the modification time of a file.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm File modification time step by step in the Icon and Unicon programming language

Source code in the icon programming language

every dir := !["./","/"] do {
   if i := stat(f := dir || "input.txt") then {
      write("info for ",f ," mtime= ",ctime(i.mtime),", atime=",ctime(i.ctime), ", atime=",ctime(i.atime)) 
      utime(f,i.atime,i.mtime-1024)
      i := stat(f)
      write("update for ",f ," mtime= ",ctime(i.mtime),", atime=",ctime(i.ctime), ", atime=",ctime(i.atime)) 
      }      
   else stop("failure to stat ",f)
   }


  

You may also check:How to resolve the algorithm Program name step by step in the Oberon-2 programming language
You may also check:How to resolve the algorithm Associative array/Iteration step by step in the SenseTalk programming language
You may also check:How to resolve the algorithm Loops/Infinite step by step in the AmigaE programming language
You may also check:How to resolve the algorithm Split a character string based on change of character step by step in the Java programming language
You may also check:How to resolve the algorithm Case-sensitivity of identifiers step by step in the Objeck programming language