From: Remco Nijkamp
Subject: How 2 find end of line with Vlisp/ACAD
Date: 
Message-ID: <378361D9.E7F20937@dataxs.nl>
Hi,

Im using vlisp to write some code which read a a line from a file
(read-line) and then start to count the number of character 'till the
end of line. When I use (chr 13), (chr 0) or "\r" to find the end of the
line all works fine.

The problem is that when I run the code note in the vlisp editor al
works fine, but when I run it from AutoCAD (14.01) it does not seem to
recognize one of the characters ((chr 13), (chr 10) ) and thus starts to
loop.

The original file is generated on a UNIX system, Vlisp/acad is running
from NT.

The code is:
( while (/= ch (chr 13))
    (setq aantal_ch (+ aantal_ch 1))
    (setq ch (substr regel aantal_ch 1))
)


This runs fine from Vlsip editor and loops in acad

please respond to ·····@dataxs.nl 'cause I'm not shure how long i'll b
able to creep through our firewall.

From: Fernando Mato Mira
Subject: Re: How 2 find end of line with Vlisp/ACAD
Date: 
Message-ID: <37836A49.F5DC7281@iname.com>
Remco Nijkamp wrote:

> Im using vlisp to write some code which read a a line from a file

You mean VLISP from the Vista framework? (Obviously you're not talking about
VLISP, the Verified implementation of Scheme).
From: Reini Urban
Subject: Re: How 2 find end of line with Vlisp/ACAD
Date: 
Message-ID: <3784d1f3.6528387@judy.x-ray.local>
[followup-to comp.cad.autocad]

Fernando Mato Mira <········@iname.com> wrote:
>> Im using vlisp to write some code which read a a line from a file
>
>You mean VLISP from the Vista framework? (Obviously you're not talking about
>VLISP, the Verified implementation of Scheme).

no, this is VisualLisp from AutoDesk, the AutoLISP successor.
VLISP treats EOL differently to ALISP.

instead of telling you your answer I changed the code to 
avoid testing for an unknown EOL (chr 10, 13 or 0) character:

(while (/= ch (chr 13))
  (setq aantal_ch (+ aantal_ch 1))
  (setq ch (substr regel aantal_ch 1))
  ...
)

;;; this is one possible looping construct
(setq aantal_ch 0)
(repeat (strlen regel)
  (setq aantal_ch (1+ aantal_ch))
  (setq ch (substr regel aantal_ch 1))
  ...
)

--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html