473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

is there a limit to array size?

HI

I am trying to do this:
array4 = split(astring,chr(9))

and it seems the array4 cannot be larger than 256

how can I get around this?
I am trying to read in a file and parse it line by line, but I cant just
import as there are more than 256 fields, so i have to read it in with code.

Thakns
Nov 12 '05 #1
7 4695
rkc

"Danny" <da********@hotmail.com> wrote in message
news:_V**********************@news4.srv.hcvlny.cv. net...
HI

I am trying to do this:
array4 = split(astring,chr(9))

and it seems the array4 cannot be larger than 256

how can I get around this?


You need to post more information about what you're doing.
Maybe the code that makes you think there is a 256 limit to the
size of an array. There isn't so you have something else going
on.


Nov 12 '05 #2
Danny wrote:
HI

I am trying to do this:
array4 = split(astring,chr(9))

and it seems the array4 cannot be larger than 256

how can I get around this?
I am trying to read in a file and parse it line by line, but I cant just
import as there are more than 256 fields, so i have to read it in with code.

Thakns


The code below knows no bounds :-)

-- code start ---
Option Compare Database
Option Explicit

Sub TestSplit()
Const cstrTestString As String = "ab|cd|efg|hijk|lm|n|opq|rs|tu|vw|xyz"
Dim strArray() As String
Dim lngNumElements As Long
Dim strTemp As String
Dim i As Long

strTemp = strTok(cstrTestString, "|")

Do While Len(strTemp)
lngNumElements = lngNumElements + 1
ReDim Preserve strArray(1 To lngNumElements)
strArray(lngNumElements) = strTemp
strTemp = strTok()
Loop

For i = 1 To lngNumElements
Debug.Print i & ": " & strArray(i)
Next
End Sub

Function strTok(Optional pstrSrce As String, Optional pstrDelim As
String) As String
Static intstart As Integer, strSaveStr As String, strDelim As String

Dim intBegPos As Integer, intEndPos As Integer
Dim intLn As Integer

On Error GoTo StrTokError
' If first call, make a copy of the string.
If pstrSrce <> "" Then
intstart = 1
strSaveStr = pstrSrce
strDelim = pstrDelim
End If

intBegPos = intstart
intLn = Len(strSaveStr)
' Look for start of a token (character that isn't delimiter).
Do While intBegPos <= intLn And InStr(strDelim, Mid(strSaveStr,
intBegPos, 1)) <> 0
intBegPos = intBegPos + 1
Loop
' Test for token start found.
If intBegPos > intLn Then
strTok = ""
Exit Function
End If
' Find the end of the token.
intEndPos = intBegPos
Do While intEndPos <= intLn And InStr(strDelim, Mid(strSaveStr,
intEndPos, 1)) = 0
intEndPos = intEndPos + 1
Loop
strTok = Trim(Mid(strSaveStr, intBegPos, intEndPos - intBegPos))

If IsNull(pstrSrce) Then
strTok = ""
End If

' Set starting point for search for next token.
intstart = intEndPos

StrTokExit:
Exit Function
StrTokError:
Resume StrTokExit

End Function

--- code end ---
--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #3

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:yE********************@twister.nyroc.rr.com.. .

"Danny" <da********@hotmail.com> wrote in message
news:_V**********************@news4.srv.hcvlny.cv. net...
HI

I am trying to do this:
array4 = split(astring,chr(9))

and it seems the array4 cannot be larger than 256

how can I get around this?


You need to post more information about what you're doing.
Maybe the code that makes you think there is a 256 limit to the
size of an array. There isn't so you have something else going
on.


Thanks
here is my code:
this file has about 300 tab delimited fields.
it does work and it finds tab delimited fields, but fails when I access more
than 256
what can I do?
dim hello1 as variant
Dim hello2 As Variant

Open "C:\mydata\sample1.txt" For Input As #1
Line Input #1, hello1
hello2 = Split(hello1, Chr(9))
' tihs always prints 255!!!!
MsgBox UBound(hello2)

..
..
..
..
..
..
..
Nov 12 '05 #4
rkc

"Danny" <da********@hotmail.com> wrote in message
news:IQ**********************@news4.srv.hcvlny.cv. net...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:yE********************@twister.nyroc.rr.com.. .

"Danny" <da********@hotmail.com> wrote in message
news:_V**********************@news4.srv.hcvlny.cv. net...
HI

I am trying to do this:
array4 = split(astring,chr(9))

and it seems the array4 cannot be larger than 256

how can I get around this?
You need to post more information about what you're doing.
Maybe the code that makes you think there is a 256 limit to the
size of an array. There isn't so you have something else going
on.


Thanks
here is my code:
this file has about 300 tab delimited fields.
it does work and it finds tab delimited fields, but fails when I access

more than 256
what can I do?
dim hello1 as variant
Dim hello2 As Variant

Open "C:\mydata\sample1.txt" For Input As #1
Line Input #1, hello1
hello2 = Split(hello1, Chr(9))
' tihs always prints 255!!!!
MsgBox UBound(hello2)


Line input reads up to the first carraige return or carraige return/line
feed
combination. Seems you have at least one in your file.

Try:

hello1 = Input (LOF(1), #1)

and see what happens.


Nov 12 '05 #5
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:Il********************@twister.nyroc.rr.com.. .

"Danny" <da********@hotmail.com> wrote in message
news:IQ**********************@news4.srv.hcvlny.cv. net...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:yE********************@twister.nyroc.rr.com.. .

"Danny" <da********@hotmail.com> wrote in message
news:_V**********************@news4.srv.hcvlny.cv. net...
> HI
>
> I am trying to do this:
> array4 = split(astring,chr(9))
>
> and it seems the array4 cannot be larger than 256
>
> how can I get around this?

You need to post more information about what you're doing.
Maybe the code that makes you think there is a 256 limit to the
size of an array. There isn't so you have something else going
on.


Thanks
here is my code:
this file has about 300 tab delimited fields.
it does work and it finds tab delimited fields, but fails when I access

more
than 256
what can I do?
dim hello1 as variant
Dim hello2 As Variant

Open "C:\mydata\sample1.txt" For Input As #1
Line Input #1, hello1
hello2 = Split(hello1, Chr(9))
' tihs always prints 255!!!!
MsgBox UBound(hello2)


Line input reads up to the first carraige return or carraige return/line
feed
combination. Seems you have at least one in your file.

Try:

hello1 = Input (LOF(1), #1)

and see what happens.


I wonder if Split might have a limit of 255?
Nov 12 '05 #6
rkc

"Randy Harris" <ra***@SpamFree.com> wrote in message
news:Yk******************@newssvr31.news.prodigy.c om...
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:Il********************@twister.nyroc.rr.com.. .

"Danny" <da********@hotmail.com> wrote in message
news:IQ**********************@news4.srv.hcvlny.cv. net...

"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote in message
news:yE********************@twister.nyroc.rr.com.. .
>
> "Danny" <da********@hotmail.com> wrote in message
> news:_V**********************@news4.srv.hcvlny.cv. net...
> > HI
> >
> > I am trying to do this:
> > array4 = split(astring,chr(9))
> >
> > and it seems the array4 cannot be larger than 256
> >
> > how can I get around this?
>
> You need to post more information about what you're doing.
> Maybe the code that makes you think there is a 256 limit to the
> size of an array. There isn't so you have something else going
> on.
>
>
>
>

Thanks
here is my code:
this file has about 300 tab delimited fields.
it does work and it finds tab delimited fields, but fails when I
access more
than 256
what can I do?
dim hello1 as variant
Dim hello2 As Variant

Open "C:\mydata\sample1.txt" For Input As #1
Line Input #1, hello1
hello2 = Split(hello1, Chr(9))
' tihs always prints 255!!!!
MsgBox UBound(hello2)


Line input reads up to the first carraige return or carraige return/line
feed
combination. Seems you have at least one in your file.

Try:

hello1 = Input (LOF(1), #1)

and see what happens.


I wonder if Split might have a limit of 255?


Easily tested and no, it doesn't.



Nov 12 '05 #7
> >
I wonder if Split might have a limit of 255?


Easily tested and no, it doesn't.


I tested it and you, of course, were correct. Looks as though he must have
a return in that file.
Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Afkamm | last post by:
Hi, :) The preg_replace function... preg_replace(pattern, replacement, subject ) How on earth do you get the limit value to work with arrays? In my code both the pattern and replacement...
2
by: Stevio | last post by:
Is there a limit to how big you can make an array in ASP VBscript? Thanks, Stephen
2
by: steve | last post by:
I am setting up a huge database in mysql, and I get the above error in Linux. I believe it is related to the size of one of my tables, which is 4,294,966,772 bytes in size. Can someone help. How...
0
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ?...
10
by: VM | last post by:
How can I limit the use of the PC's virtual memory? I'm running a process that basically takes a txt file and loads it to a datatable. The problem is that the file is over 400,000 lines long (77...
3
by: yehaimanish | last post by:
I am developing an application by which to parse the content from the access_log and insert it into the database. Since each row is an different entry, I am using file() to get the contents into an...
2
by: pbramesh | last post by:
Hi, How C limit the size of an array? I declared an integer array of size 3. like int a; But I can store more that 3 elements into it. Why this happen? Please help Thanks,
2
by: D. Susman | last post by:
Hi, I know that this issue is indeed strictly operating system dependent but I am just curious: I have a five dimensional array, whose size sums to 68 MB (almost). This array is contained by...
10
by: orsula | last post by:
Hi Guys, I have a class A composed of several string and int members. I would like to manage a huge amount (several thousands) of A objects in a dictionary where each object has its unique key....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.