[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with replacing LFs with CRs for //e
Barry Davis wrote:
> I have looked high and low for a program to replace the LFs with CRs in
> text
> files. I have found a number of programs that will remove linefeeds or
> returns but not one for the //e that will replace a linefeed ($0A) with
> a
> return ($0D) all in one batch. I have found a number that work with the
> GS. I have tried using Fredwriter, but have not been able to use the
> return
> character in the find sequence. Could someone please point me in the
> write
> direction? Barry
>
Simple Applesoft program. I presume you can write the program on your own
if I give you directions.
1) Take care of opening the input file and an output file.
2) Read in a single character from the input file
3a) If there is an error then close both files (end of file) and go to
step 5
3b) Compare the input character to chr$(10) - if it is then send chr$(13)
to the output file
3c) If the input character isn't chr$(10) then send it to the output file
4) Start over with step 2
5) Do what you want with the two files
This program is very slow. There is a ProDOS call which allows the end of
line character to be changed. You may consider using this to change it to
chr$(10) and performing an input rather than a get. Then use a print with
a ";" (no end of line) then manually insert the chr$(13) with a ";". This
should be faster.
Later
Mike
--
+----------------------------------------------------------------------+
| Digital Civilization magazine: http://www.digitalcivilization.ca |
| Call-A.P.P.L.E. magazine & BBS http://www.callapple.org |
| http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.) |
| See my web page before you think about spamming me. I charge cash. |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------