Page 1 of 1 1
Topic Options
#15911 - 2002-01-09 04:10 PM Expression too long
Anonymous
Unregistered


Hi!

I was going to make a script that took a file (726 754 byte) single line and write it into a new file with added CR/LF every 122 character.

But Readline doesn't like so long expressions.

Any suggestions how to do it?

kix32 radbryt.kix $INFIL="xxx" $UTFIL="XXX"

My script:

$Start = 1
$Antaltecken = 122

Open( 1 , "$INFIL" , 2 )
Open( 2 , "$UTFIL" , 1 )

$Filrad = ReadLine( 1 )
While @ERROR = 0
$Nyrad = SubStr( "$Filrad" , $Start , $Antaltecken )
WriteLine( 2 , $Nyrad + Chr(13) + Chr(10) )
$Start = $Start + 122
Loop

Close( 2 )
Close( 1 )

Top
#15912 - 2002-01-09 05:03 PM Re: Expression too long
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
erny,
Maybe someone will prove me wrong, but I don't believe KiX has any command or function that would acheive your goal. I would suggest you look to a text editor with macro capability. My old favorite is ED (formerly PE) from WordPerfect Corp. (now defunct), but I'm sure there are many others.

You may, alternatively be able to do it in VB or C but I know neither.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#15913 - 2002-01-09 06:05 PM Re: Expression too long
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Hi Erny / Les,

quote:
Don't underestimate the power of KiXtart!

---------------
BREAK ON CLS

$InFile="testin.txt" ; tested size = 909,824
$OutFile="testout.txt"

$Start = 1
$BreakAt = 122

$FileSize=GetFileSize($InFile)

$nul = Open( 1 , $InFile )

DEL $OutFile
$nul = Open( 2 , $OutFile , 5 )

$TestLine=ReadLine( 1 )

while $Start<$FileSize
$nul = writeline( 2 , Substr( $testline , $Start , $BreakAt ) + chr(13) + chr(10) )
$Start = $Start + $BreakAt
loop

Close( 2 )
Close( 1 )
-----------------------

But it is strange... Kix isn't supposed to be able to handle Variables longer than 32,000 bytes...

You can't show the string but you can apperantly edit it with a subst though...

Script above is tested with Kixtart2001 (v4.0.1) on a W2K Workstation.

[ 09 January 2002: Message edited by: DrillSergeant ]

_________________________
The Code is out there

Top
#15914 - 2002-01-09 06:15 PM Re: Expression too long
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rogier,

Yeah - I've been scratching my head about this MAX string size thingy too ... whazzup with that ? Ruud must have did something in 4.0 to handle this. And what about the MAX file size ? I think I remembered reading that there was a limitation there too (64K?) ... oh well, don't look a gift horse in the mouth I always say ... nice work !

-Shawn

Top
#15915 - 2002-01-09 06:46 PM Re: Expression too long
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Roger,
Thanks. Bad of me to assume and not take on the challenge. You are the better man.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#15916 - 2002-01-09 06:52 PM Re: Expression too long
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Don't sweat it Les. I didn't try either because I thought I couldn't be done.
Top
#15917 - 2002-01-09 06:54 PM Re: Expression too long
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
The better? nah, more curious... maybe
_________________________
The Code is out there

Top
#15918 - 2002-01-09 09:47 PM Re: Expression too long
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Roger,

It's good that you are curious, like Shawn, i said to my self:
- max size of strings 32k
- max size of files 64k
So don't try it

This rises a question, whitch functions support strings > 32k, and will this be supported in future
releases of KiXtart?
Can i use: Split, Trim, RTrim, LTrim and InStr also ????

-Erik

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.028 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