' A textfile convertor. ' By A.A. van Zoelen ' Version 1.0 1-Okt-1997 ' E-Mail : vsim@xs4all.nl ' ' Description: ' Text file downloaded from the net contains often a different ' code used for cartridge return [CR]. This makes the document ' less readable. This program will convert these codes to codes ' that are used by DOS. ' ' Actions taken: ' ASCII character 10 will be replaced by a CR [DOS] ' and ASCII character 13 will be replace by a SPACE. ' ' Notes: ' This code is made for PowerBasic. If you want to use it ' for Qbasic then remove $COMPILE and ' INCR must become Lines% = Lines% + 1 $COMPILE EXE 'Switch for PowerBasic so 'it will create an EXE. $STRING 32 'And use a max. string 'size of 32750 CLS 'Clear screen PRINT " UNIX to DOS v1.0" 'Prog. info PRINT " Textfile convertor." PRINT " by A.A. van Zoelen" FileName$ = Command$ 'Get commandline parameter IF FileName$ = "" THEN 'If none found this explain PRINT 'the usage of this program. PRINT " USAGE : UNIX2DOS " PRINT END END IF NAME FileName$ AS "TEMP" 'Rename file to convert OPEN "TEMP" FOR BINARY AS 1 'Open file for reading OPEN FileName$ FOR OUTPUT AS 2 'Open new file for writing FileSize??? = 0 'Line counter reset to zero DO BlockSize% = MIN(LOF(1) - FileSize%, 32750) GET$ #1, BlockSize%, Dump$ 'Get characters one at a time. DO Place% = INSTR(Dump$, CHR$(10)) IF Place% <> 0 THEN Place% = 0 PRINT #2, LEFT$(Dump$, Place%) Dump$ = RIGHT$(Dump$, LEN(Dump$) - Place%) END IF LOOP UNTIL Place% = 0 REPLACE CHR$(13) WITH " " IN Dump$ IF LEN(Dump$) <> 0 THEN PRINT #2, Dump$; 'then output the found character LOOP UNTIL EOF(1) OR BlockSize% = 0 CLOSE 2 'Close file number 2 CLOSE 1 'Close file number 1 KILL "TEMP" 'Remove temperory file END ' ------ [ End of File ] -------------------------------------------------