•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 425,875 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,307 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
This snippet shows how to open, read, write and close text files. This skeleton can be modified to handle any type of file, from untyped to text to typed files.
procedure CopyFile; var F1 : text; F2 : text; FN1 : string; FN2 : string; begin FN1 := 'infile.txt'; FN2 := 'outfile.txt'; assign( F1, FN1 ); reset( F1 ); { open file for reading } assign( F2, FN2 ); rewrite( F2 ); { open file for writing, destroying contents, if any } while not EOF( F1 ) do begin readln( F1 ); { file manipulation goes here } writeln( F2 ); end; close( F1 ); close( F2 ); end;
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)