Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.


Arrays of any size


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-15-2007, 08:50 PM
Junior Member
 
Join Date: May 2007
Location: Chicago Illinois USA
Posts: 14
Default Arrays of any size

Perhaps this is elementary, but I needed very large arrays of information for my program. I put all the information in a single-dimension array and then strip the parts out when needed.
Example: ser="12b*3a4*5n6*78y*9ab2nm*"

dim a(5)
h1=0
For x=1 to 5:g1=Strindexof(ser,"*",h1)
a(x)=Substring(ser,h1,g1-h1)
h1=g1+1:next x
Reply With Quote
  #2 (permalink)  
Old 08-16-2007, 10:16 AM
Junior Member
 
Join Date: May 2007
Posts: 17
Default Arrays of any size

hi
indexes start from 0 , try
a(x-1)
Reply With Quote
  #3 (permalink)  
Old 08-16-2007, 06:47 PM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

yes, a(x-1) works for Dim a(5)

for me as an alternative approach, If it is large or varying handling data memory assignments, maybe I'll try the method that the code will create file as data memory which it could arrange and simplify informations, then access and manipulate by read and write in this file. Not sure if applicable to your program.
__________________
Rioven

Sony Ericsson XPERIA X1i WM6.1
480x800 Display Resolution
with QWERTY keyboard
Reply With Quote
  #4 (permalink)  
Old 08-16-2007, 06:52 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

Creating a long string takes (almost) as much memory as creating an array of substrings.
The overhead of this approach could be pretty large.
Reply With Quote
  #5 (permalink)  
Old 08-17-2007, 02:32 AM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thanks Erel, bit but if I wan't to store large random data, Is it efficient using binary files? or what is the right method?
__________________
Rioven

Sony Ericsson XPERIA X1i WM6.1
480x800 Display Resolution
with QWERTY keyboard
Reply With Quote
  #6 (permalink)  
Old 08-17-2007, 05:55 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

It depends on the type of the data.
If you save only numbers then random files are the best solution.
That is because you can easily calculate the position of each value (NumberOfBytes * Index).
However strings do not have a fixed size so it is much more complicated to find the position of each value, making it less useful in that case.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing arrays to Subs. jesb4ppc Questions & Help Needed 6 04-15-2008 06:03 PM
Filling 2-D arrays. grgczyz Basic4ppc Wishlist 1 02-14-2008 12:38 PM
Passing arrays in B4PPC6? Frank Questions & Help Needed 1 01-14-2008 01:15 PM
Filling arrays Erel Code Samples & Tips 3 01-13-2008 06:11 PM
screen size to form size relation Cableguy Basic4ppc Wishlist 2 08-14-2007 10:40 PM


All times are GMT. The time now is 11:17 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0