💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › apple8 › Pgms › eolco… captured on 2023-01-29 at 10:55:09.
-=-=-=-=-=-=-
On Fri, 23 Jun 2000 00:01:07 -0500, Rubywand <rubywand@swbell.net> wrote: > The program reads through BINSCII.EXE and swaps in CR's for LF's. The >corrected Text is saved in RAM and used to create BINSCIIX. EXEC BINSCIIX to >get BINSCII. > > 100 ONERR GOTO 170 > 110 PRINT CHR$ (4)"OPEN BINSCII.EXE" > 120 PRINT CHR$ (4)"READ BINSCII.EXE" > 130 GET C$ > 140 IF ASC (C$) = 10 THEN C$ = CHR$ (13) > 150 N = N + 1: POKE 8191 + N, ASC (C$): IF N / 100 = INT (N / 100) > THEN Z = FRE (0): PRINT "*"; > 160 GOTO 130 > 170 PRINT : PRINT CHR$ (4)"CLOSE" > 180 POKE 216,0 > 190 PRINT CHR$ (4)"OPEN BINSCIIX" > 200 PRINT CHR$ (4)"WRITE BINSCIIX" > 210 FOR I = 1 TO N - 1: PRINT CHR$ (PEEK (8191 + I));: NEXT I > 220 PRINT : PRINT CHR$ (4)"CLOSE" > 230 END Well, you forgot to clean up the stack again but as you seem to have made this program overly complex, I'll post a version that will convert either LF or CR/LF end of lines to just CR. 100 ONERR GOTO 210 110 D$ = CHR$(4) 120 PRINT D$;"OPEN BINSCII.EXE" 130 PRINT D$;"OPEN BINSCIIX" 140 PRINT D$;"READ BINSCII.EXE" 150 LC$ = C$:GET C$ 160 IF ASC(C$) = 10 AND LC$ <> CHR$(13) THEN C$ = CHR$(13): GOTO 180 170 GOTO 150 180 PRINT D$;"WRITE BINSCIIX" 190 PRINT C$; 200 GOTO 140 210 POKE 216,0: CALL -3288 220 PRINT D$;"CLOSE" 230 END The main point of interest in this program is line 160. If the character we just got is a line feed, it checks to see if the last character received was a carriage return. If it wasn't, then we are dealing with a file with just line feed as the end of line marker so we change it to a carriage return and write it to the new file. If the character we just got is a line feed and the last character received was a carriage return, then we are dealing with a file with CR/LF as the end of line marker. In this case we simply ignore the line feed (meaning we don't write it to the new file) and continue copying the file with the character after the line feed. Please note that I have not actually tested this program. I simply typed it in using my news reader. If I get the chance I will test it but if anyone tries to use it and it doesn't work, please let me know. By the way, both this program and the COPYMOST that I posted a while back are both public domain. Let's call this one EOLCONVERT. +------------------------------------------------------------------------+ | Jeff Blakeney - Dean of the Apple II University in A2Pro on Delphi | | Delphi Apple II Forums Web Pages | | A2: http://www.delphi.com/apple2 A2Pro: http://www.delphi.com/a2pro | +------------------------------------------------------------------------+