Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Bug in CHARIN

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Bug in CHARIN
#13607
Posted by: Michael S 2012-06-02 19:52:21
I think I've discovered a bug in CHARIN.

I've attached a file that can be used together with the test script. Basically, it seems that if you've read x bytes from a file and then try and reset the pointer back to byte 1, the next read always starts reading from byte 2. If you try and set the pointer to 0 then charin complains. Try the following script using the attached file.
test_charin.rextest_file.DAT
Message2.
#13608
Posted by: Jeff Glatt 2012-06-06 07:37:51
Not a bug. You're not using CHARIN correctly. Here's the docs for the third arg

length indicates the requested number of characters to read in. If 0, then CHARIN() merely sets the "read character position" to position without reading any characters and returns an empty string. (ie, Similiar to using STREAM's SEEK). If length is omitted, CHARIN() defaults to reading only 1 character.

So your line...
temp = CHARIN(ansi_filein, 1)

... sets the position to 1 and then also reads the first char. Obviously, the next CHARIN will start at the second char (unless you supply another position). Try...
temp = CHARIN(ansi_filein, 1, 0)
Message3. Ahaaaaa !
#13609
Posted by: Michael S 2012-06-12 03:03:21
Thanks Jeff - will test at work tomorrow
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥333.00 ·
 
 
¥370.00 ·
 
 
¥660.00 ·
 
 
¥1,360.00 ·
 
 
¥860.00 ·
 
 
¥890.00 ·
© Tue 2024-11-5  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0