[metapost] a better question
Walt Burkhard
burkhard at cs.ucsd.edu
Thu Jan 5 22:37:15 CET 2017
Hello
I have a short metapost program attached the uses the reads from and
scan token commands. I do not understand why the program works
in the way it does. There are two files: the file named stringTest
contains one line 2.56 7.23 The file named test.mp is shown below.
numeric n ; string jkjk ;
jkjk := readsfrom ( "stringTest" ) ; message ( jkjk ) ; % shows 2.56
7.23
n := scantoken ( jkjk ) ; % this parses/reads 2.56 and sets n to be
2.56
% evidently.
message ( "n = "&decimal n ) ; % shows n = 2.56
n := scantoken ( jkjk ) ; % still sets n to be 2.56
I have attached both files here. Any suggestions on how I should be
reading the
second numeric value from the string would be appreciated. The User's
guide
says that the scantoken command processes tokens sequentially. (page 17)
Many thanks in advance.
Walt Burkhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20170105/127cbe5d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.mp
Type: application/octet-stream
Size: 336 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20170105/127cbe5d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stringTest
Type: application/octet-stream
Size: 11 bytes
Desc: not available
URL: <http://tug.org/pipermail/metapost/attachments/20170105/127cbe5d/attachment-0001.obj>
More information about the metapost
mailing list