[futurebasic] Re: [FB] ASCII Text Not Being Print#ed??

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2001 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Fri, 07 Dec 2001 22:32:44 +0100
Jeff810095@... wrote:
> 
> Hi,
> 
> Do these two functions work with the entire ASCII character set?
>     READ#1, rectRecord$;1
>     PRINT#2, rectRecord$;
> 
> I wrote a program to strip out LineFeeds where a CR+LF pair is encountered
> (so I can print this "PC" file from my Mac without extra blank lines). Odd
> thing is after I convert the file other characters seem to be affected too. I
> counted all the ASCII characters before converting and after converting to a
> new file. See below.
> 
> This is basically the code that does that:
> 
>   y&=LOF(1,1)
>   FOR x&=1 TO y&
>     READ#1, rectRecord$;1
> 
>     IF ASC(prev$)=13 AND ASC(rectRecord$)=10 THEN "skipLF"
>     PRINT#2, rectRecord$;
>     "skipLF"
>     prev$=rectRecord$
> 
>    NEXT x&
>   CLOSE #1:CLOSE #2
> 
> Anybody know why it appears many characters aren't getting Print#ed to the
> new file?
> 

> 
> Any suggestions appreciated....
> Jeff-
> 
Jeff,

I don't know if it is related to your problem, but a few releases
ago FB^3 had an issue resetting properly the file marker in some
instances. The cure was to force the darn thing to start reading at
the top of the file with the RECORD statement. Right after the
opening of the file write this:
RECORD(#YourIOChanel,0).
According to your explanations, I would suggest another approach.
First, Read the whole file in memory and apply Munger to remove the
unwanted characters then save the resulting handle, you would
immediately notice the difference especially in speed and perhaps
also in reliability regarding the logical treatment of the data.
-- 

Cheers

Alain

-----------------------------------------------------
FB^3 in Europe:  http://euro.futurebasic.com/
FB II Pouch:     http://www.pixmix.com/FB/outils.html
-----------------------------------------------------