'=========================================================================== ' Subject: SORT UTILITY FOR PB/CC Date: 06-27-98 (00:00) ' Author: PowerBASIC, Inc. Code: PBCC ' Origin: ftp.powerbasic.com Packet: PBCC.ABC '=========================================================================== '============================================================================== ' ' Sort utility for PowerBASIC Console Compiler ' Copyright (c) 1998 by PowerBASIC, Inc. All Rights Reserved. ' ' Like the DOS SORT.EXE utility, this program accepts text via STDIN, ' sorts it (case insensitive) and writes the sorted text to STDOUT. ' ' As a Win32 console application it supports long filenames and text ' files are large as virtual memory (2 gigabytes maximum). ' '============================================================================== FUNCTION PbMain() AS LONG LOCAL count AS LONG LOCAL x AS LONG DIM text(1 to 100000) AS STRING WHILE NOT STDEOF INCR count STDIN LINE text(count) WEND ARRAY SORT text(1) FOR count, COLLATE UCASE FOR x = 1 TO count STDOUT text(x) NEXT x END FUNCTION