MODULE essai7; (* test minimal de lecture de fichier char par char*) FROM IOResult IMPORT ReadResults, ReadResult; FROM TextIO IMPORT ReadRestLine, SkipLine, ReadToken, WriteLn, WriteString, ReadChar; FROM SeqFile IMPORT OpenRead, OpenWrite, OpenResults, Close, ChanId, read, write; IMPORT STextIO, SWholeIO; VAR theChanId : ChanId; theResult : OpenResults; BEGIN (* principe : on ouvre, on lit les chars les uns après les autres et on les affiche*) (* une fois arrivé au bout du fichier, on le ferme *) STextIO.WriteString("Hello you all ! ... be ready for the ISO libs tests !"); STextIO.WriteLn; STextIO.WriteString("trying to open a file and display the content,char by char"); STextIO.WriteLn; STextIO.WriteString("trying exeptions ..."); STextIO.WriteLn; (* ouverture du fichier*) OpenRead(theChanId, "test126.mod", read, theResult); IF theResult = noSuchFile THEN STextIO.WriteString("The file doesn't exist ; halting"); STextIO.WriteLn; HALT; ELSE (* test du résultat*) IF theResult=opened THEN (*le fichier est ouvert*) STextIO.WriteString("file opened!"); ELSE STextIO.WriteString("Error opening the file"); STextIO.WriteLn; END; Close(theChanId); END; END essai7.