home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / mep1 / Samples / Programs / catenate.icn next >
Encoding:
Text File  |  1989-05-09  |  936 b   |  29 lines  |  [TEXT/PICN]

  1. ############################################################################
  2. #
  3. #  catenate.icn
  4. #  
  5. #     This program concatenates files.  The user is prompted for an output
  6. #  file with a Put File dialog. Then the user is prompted for the files
  7. #  to concatenate with a Get File dialog. When one set of files is done,
  8. #  the user is prompted with another Put File dialog. The program
  9. #  terminates when the user selects Cancel in a Put File dialog.
  10. #
  11. #############################################################################
  12.  
  13. procedure main()
  14.     local outname, outfile, inname, infile
  15.  
  16.     while outname := putfile("Output file?") do {
  17.         close(\outfile)
  18.         outfile := open(outname,"w") | stop("*** cannot open ",outname)
  19.         inname := "..."
  20.  
  21.         while inname := getfile("File? (last was " || inname ||" )") do {
  22.             close(\infile)
  23.             infile := open(inname) | stop("*** cannot open ",inname)
  24.  
  25.             while write(outfile,read(infile))
  26.             }
  27.         }
  28.  
  29. end