Re: How to efficiently allocate space for a variable length string in VB6?
- From: Mike Scirocco <mscir@xxxxxxxxx>
- Date: Mon, 27 Feb 2006 10:09:47 -0800
interpasha@xxxxxxxxxxx wrote:
Hi, everyone!
I am working on a medium-size data acquisition project.
I need to allocate (10megabytes+) space for a variable-length string in
VB6 to store incoming data. Fixed-length string won't work as its 64kb
max.
The DLL for the hardware sensor that I am using, expects to find a
string with space already allocated for it.
What is the most efficient way to instantiate a large variable-length
string?
I thought I could use ReDim to allocate space, but I was not able to
figure out how to use it with a string.
As of now, I am using highly inefficient code such as:
Dim myString As String
Dim i As Long
myString = "AAAAA"
For i = 1 To 250000
myString = myString & "AAAAA"
Next i
I'd try the String function, this code ran without a problem on my VB6 win98 192MB system:
Private Sub Command1_Click()
Dim a As String
a = String(100000000, "A")
MsgBox "done"
End Sub
Mike
.
- Follow-Ups:
- References:
- Prev by Date: How to efficiently allocate space for a variable length string in VB6?
- Next by Date: Re: How to efficiently allocate space for a variable length string in VB6?
- Previous by thread: How to efficiently allocate space for a variable length string in VB6?
- Next by thread: Re: How to efficiently allocate space for a variable length string in VB6?
- Index(es):
Relevant Pages
|