*/
Know a good article or link that we're missing? Submit it!
*/

View SAMPLES\FILEPTRS.PAS

Portable ISO Standard Pascal in C, version 3.8

Submitted By: WEBMASTER
Rating: starstarstarstar (Rate It)


(*$c+*)
PROGRAM fileptrs(Input, Output);
 Procedure readwrite;
 VAR Prd : TEXT;
 BEGIN
  {- Prd is a local text file that is removed on -}
  {- exit. See note below on use of the Input file. -}
  REWRITE(Prd); RESET(Input);
  WHILE NOT EOF(Input) DO
   BEGIN
    IF NOT EOLN(Input) THEN
     BEGIN Prd^ := Input^; PUT(Prd) END
    ELSE WRITELN(Prd);
    GET(Input)
   END;
  RESET(Prd);
  WHILE NOT EOF(Prd) DO
   BEGIN
    IF NOT EOLN(Prd) THEN
     BEGIN Output^ := Prd^; PUT(Output) END
    ELSE WRITELN(Output);
    GET(Prd)
   END
 END;
BEGIN
 WRITELN(
'Enter sentences separated by line feeds, ended by Ctrl-Z<ENTER>:'
 );
 WRITELN;
 {- NOTE: A CALL OF 'GET(Input)' OR 'RESET(Input)' CAUSES -}
 {- THE SYSTEM TO 'HANG UP' UNTIL THE KEYBOARD IS PRESSED. -}
 {- THUS, THE POSITION IN WHICH 'RESET(Input)' APPEARS IN -}
 {- THIS PROGRAM DETERMINES WHETHER IT WORKS PROPERLY. -}
 readwrite
END.

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.