Page 1 of 1 1
Topic Options
#74536 - 2003-04-15 02:45 AM Writeline Limitations
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
I have a project where I must create a single-line upload file. Through testing it appears KiX is limited to 31,999 characters that can be written on a single line. My question, does anyone know if such a write process truly writes 31,999 characters on a single line? I script w/Notepad, and its limits of 1024-characters makes it appear that the file has 32 lines (using GOTO Line brings me to additional lines). My guess is the process writes properly as a single line, but I've no other tools to verify.

Can anyone help me with this? I'd appreciate it.

Bill

My simple test script:
code:
$Fil = "C:\Temp\wl.txt"
$Idx=0
$Chk=31999
$Char=A
OPEN (1, $Fil, 5)
DO
$Char=$Char + "A"
$Idx=$Idx+1
? "Idx: $Idx"
UNTIL ($Idx = $Chk)
$wri = writeline (1, "$Char" + @CRLF)
CLOSE (1)


Top
#74537 - 2003-04-15 02:58 AM Re: Writeline Limitations
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
UltraEdit can show your file. I have version 8.10b. It displays a text line of 31,999 "x"'s as multiple lines of ~4,095 chars (max length) but does not increment the line numbers until the next line (CRLF) is encountered.

[ 15. April 2003, 03:00: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#74538 - 2003-04-15 03:04 AM Re: Writeline Limitations
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Thanks Howard!
Top
#74539 - 2003-04-15 11:25 AM Re: Writeline Limitations
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Using UltraEdit v10.0b I get the following results.

7 Columns of 4200 A characters
1 Column of 2600 A characters
for a total of 32,000 characters (0 idx starts the count)

KiXtart v4.12 used for testing.

Modifying code from 31999 to 32000 returns error

quote:
Idx: 31998
Idx: 31999
Idx: 32000Script error: expression too long!
$wri = writeline (1, "$Char" + @CRLF)

Using KiXtart v4.21-RC2 I get the following result

quote:
Idx: 31998
Idx: 31999
Idx: 32000
ERROR : expression too long!
Script: C:\SCRIPTS\test.kix
Line : 14


Top
#74540 - 2003-04-15 01:38 PM Re: Writeline Limitations
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually, your script counts wrong.

with:


$Fil = "C:\Temp\wl.txt"
$Char = ""
$ = OPEN (1$Fil5)

for $=1 to 32000
$Char=$Char+"A"
"count: " $
next

$ = writeline (1$Char)
$ = CLOSE (1)



I verified that it writes 32,000 chars just fine.

I even made it write 32,001 and it didn't error either.

the limitation is not in writeline but in string manipulation routines
_________________________
!

download KiXnet

Top
#74541 - 2003-04-15 02:10 PM Re: Writeline Limitations
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
And this example will create a 50,000 character "line".

$sFile="C:\Temp\wl.txt"

; Construct 10,000 character string.
$sSpace10=" "
For $iIndex=1 To 1000
$sSpace10000=$sSpace10000+$sSpace10
Next
$nul=Open(1,$sFile,5)
$nul=Writeline(1,$sSpace10000+$sSpace10000+$sSpace10000+$sSpace10000+$sSpace10000)
$nul=Close(1)

Top
#74542 - 2003-04-15 04:14 PM Re: Writeline Limitations
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
right.
so we get back to my comment [Wink]
the limitation is not in writeline [Big Grin]
_________________________
!

download KiXnet

Top
#74543 - 2003-04-15 04:44 PM Re: Writeline Limitations
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Using FOR/NEXT I still ran into limitations as well. However, a programmer friend suggested the following simple change - remove the line feed for each write - and I easily wrote 100,000 characters to a line. Downloaded UltraEdit and it saw as 1 line, 100,000 characters. Logic for my script is to not use CRLF with any write. Duh!
Bill

code:
$Fil = "C:\Temp\wl.txt"
$Char=A
OPEN (1, $Fil, 5)
FOR $Idx=1 to 100000
$wri = writeline (1, "$Char")
NEXT
CLOSE (1)


Top
#74544 - 2003-04-16 12:45 AM Re: Writeline Limitations
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Okay, so my question then is:

What is @CRLF doing to the file that is causing the error?

Top
#74545 - 2003-04-16 12:54 AM Re: Writeline Limitations
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
NTDOC -
Don't think its @CRLF. Comparing FOR/NEXT and my original DO/UNTIL test, failure is occuring in different place with strings of different sizes (+50,000 vs 32,000). Lonkero probably nailed it related to string manipulation. Now where that's failing, unsure since both scripts are building a single string variable of 'x' characters.

Since my final 'solution' writes/appends single characters to the line, not working with any large strings.

Bill

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 633 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.102 seconds in which 0.067 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org