1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| program lecteurtxt;
type
tab = array[1..10] of string;
VAR F : text; S : string; i:integer; MonTableau : tab;
BEGIN
i:=0;
assign(F,'texte.dat');
filemode:=2;
reset(F);
WHILE NOT eof(F) DO
BEGIN
inc(i);
readln(F,S);
MonTableau[i]:=s;
writeln('Montableau ',i,' est : ', s);
if MonTableau[i]='1' THEN MonTableau[i]:='2';
writeln('maintenant Montableau ',i,' est : ', Montableau[i]);
readln;
END;
readln;
writeln('fermeture fichier');
writeln('assignation fichier');
readln;
assign(F,'texte.dat');
filemode:=2;
writeln('réouverture en écriture');
readln;
rewrite(F);
readln;
writeln('nouvelle boucle');
for i:=1 to 10 do
BEGIN
writeln(F, MonTableau[i]);
writeln(' s vaut : ', Montableau[i]);
readln;
END;
close(F);
END. |
Partager