' UNIX2DOS 2.0 ' ' A textfile convertor. ' By A.A. van Zoelen ' Version 1.0 01 Oktober 1997 ' PB 3.1 version ' Version 2.0 14 September 1998 ' PBCC 1.0 version ' E-Mail : vsim@xs4all.nl ' ' Description: ' Text files 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. ' ' Compiler switches $STACK 4096 ' let's use a 4k stack $OPTION VERSION4 ' Win95/98 and NT 4.0 compatible FUNCTION PBMAIN() AS LONG CLS 'Clear screen PRINT " UNIX to DOS v2.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 " Or drag-and-drop file on to it. PRINT PRINT "Press any key to continue." INPUT FLUSH Dump$ = WAITKEY$ EXIT FUNCTION 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 FUNCTION ' ------ [ End of File ] -------------------------------------------------