Peter

MapBasic's Line Input # statement recognizes the ASCII CR character as and
end-of-line indicator, whether or not the following character is an ASCII
LF.

Therefore you cannot develop a MapBasic program to read text lines that
include embedded CR characters.

Your only solution is to pre-process the text file using a text editor or a
custom program that supports character-at-a-time input and replace any
embedded CR characters with another character in the range Chr(32)..Chr(255)
such as Chr(124)="|" .

For example, I once developed a Delphi program called FIXCR that performs
this task.  FIXCR used the Delphi BlockRead() procedure to read the input
1000 characters at a time and the WriteLn() procedure to  write the output
one line at a time, fixing embedded CRs as it went.

Regards
David M Haycraft
Information Analysis Associates  Pty Ltd
ABN 47 085 516 105
1 Cumming Place, Wanniassa, 2903
Aust Capital Territory,  Australia
Phone/Fax:  61 + 2 + 6231 8104
Mobile: 0412 001 134
Email:  [EMAIL PROTECTED]
Web :  www.acslink.aone.net.au/actaa/iaa.htm
A MapInfo Technology Partner

----- Original Message -----
From: "Peter Zyczynski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, 22 April 2002 17:00
Subject: MI-L MBX - text file reading


> Hi all,
>
> Can any of you budding programmers out there tell me if its
> possible to read a text file one character at a time, as
> opposed to a whole line at a time?
>
> My text file has occurrences of the carriage return
> character (which doesn't necessarily represent an end of
> line), as well as carriage accompanied by a line feed
> character (these represent end of line)
>
> I need to test for a carriage return with an accompanying
> line feed.  MBX thinks that a single CR is end of line - my
> nemesis!
>
> Thanks,
>
> Peter Zyczynski
> Insight.GIS
> Australia
> Ph:  (03) 6244-7344
> Fax: (03) 6244-7028
> [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to