mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 18:07:56 +02:00
fixed bugs no rewrite/reset for pipes
This commit is contained in:
parent
9349ee6df6
commit
941a4fe391
@ -12,16 +12,14 @@ begin
|
||||
assignpipe(pipi,pipo);
|
||||
if linuxerror<>0 then
|
||||
Writeln('Error assigning pipes !');
|
||||
Writeln ('Rewrite Output pipe');
|
||||
rewrite (pipo);
|
||||
Writeln ('Reset Input pipe ');
|
||||
reset (pipi);
|
||||
Writeln ('Writing to pipe, and flushing.');
|
||||
Writeln (pipo,'This is a textstring');flush(pipo);
|
||||
Writeln (pipo,'This is a textstring');close(pipo);
|
||||
Writeln ('Reading from pipe.');
|
||||
Readln (pipi,s);
|
||||
Writeln ('Read from pipe : ',s);
|
||||
close (pipo);
|
||||
While not eof(pipi) do
|
||||
begin
|
||||
Readln (pipi,s);
|
||||
Writeln ('Read from pipe : ',s);
|
||||
end;
|
||||
close (pipi);
|
||||
writeln ('Closed pipes.');
|
||||
writeln
|
||||
|
@ -12,17 +12,16 @@ begin
|
||||
if not (paramstr(1)='-son') then
|
||||
begin
|
||||
Writeln ('Calling son');
|
||||
Assignstream (Si,So,'./ex38a -son');
|
||||
Assignstream (Si,So,'/home/michael/fpk/rtl/linux/ex38a -son');
|
||||
if linuxerror<>0 then writeln ('AssignStream failed !');
|
||||
{$i-}
|
||||
{ rewrite (so);
|
||||
if ioresult<>0 then writeln ('Error !!');
|
||||
reset(si);
|
||||
if ioresult<>0 then writeln ('Error !!');
|
||||
} Writeln ('Speaking to son');
|
||||
For i:=1 to 10 do writeln (so,'Hello son !');
|
||||
Writeln ('Speaking to son');
|
||||
For i:=1 to 10 do
|
||||
begin
|
||||
writeln (so,'Hello son !');
|
||||
if ioresult<>0 then writeln ('Can''t speak to son...');
|
||||
end;
|
||||
For i:=1 to 3 do writeln (so,'Hello chap !');
|
||||
flush (so);
|
||||
close (so);
|
||||
while not eof(si) do
|
||||
begin
|
||||
readln (si,s);
|
||||
@ -30,7 +29,6 @@ begin
|
||||
end;
|
||||
Writeln ('Stopped conversation');
|
||||
Close (Si);
|
||||
Close (so);
|
||||
Writeln ('Put down phone');
|
||||
end
|
||||
Else
|
||||
@ -43,6 +41,7 @@ begin
|
||||
Writeln ('Hello Dad !')
|
||||
else
|
||||
writeln ('Who are you ?');
|
||||
end
|
||||
end;
|
||||
// close (output);
|
||||
end
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user