Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Need a format to write large .dat file with numbers

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-03-2008, 11:07 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 269
Default Need a format to write large .dat file with numbers

Hi,

I need the best format to write a large DAT file with numbers from a loop.

idea:

openfile of some sort
For c1 = 1 to x
For c2 = 1 to y
For c3 = 1 to z
Write (c1,c2,c3,c1*c2*c3) to a file in some number format
next
next
next
closefile of somesort


In other words which keywords do I use? FilePut, FileWite etc.
If anyone has an example I'd appreciate it very much....

thnx

Marc

Last edited by Stellaferox : 02-03-2008 at 11:08 AM. Reason: spelling
Reply With Quote
  #2 (permalink)  
Old 02-03-2008, 12:59 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

If it was me doing this then I'd put all the values into a table and simply save the table to CSV.
I would think that this would be faster than writing each value to the file separately.

Ragards,
randomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #3 (permalink)  
Old 02-03-2008, 01:08 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 269
Default

Yes, that would definitely be the best approach but I need 133784560 entries!
Reply With Quote
  #4 (permalink)  
Old 02-03-2008, 06:43 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

The best approach is to use a random access file.
Open the file with FileOpen(c,"filename",cRandom).
Now you have two options:
1. Use FileGet / FilePut and save the numbers as double type (8 bytes per number).
2. BETTER: Use BinaryFile to write and read the required types.
Reply With Quote
  #5 (permalink)  
Old 02-04-2008, 01:16 AM
Senior Member
 
Join Date: May 2007
Posts: 174
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi guys,
could be darn question...

If large data will be splited in two or more data files and then do some filters in opening a necessary file where to read particular data, is it an advantage in some way or not?

regards,
__________________
Rioven

DEVICE: Motorola ATRIX (Dual Core) Android 2.2.1
DESKTOP: Intel Pentium Dual-core E5200; Microsoft® Windows® Vista Home (Basic); Hard Disk:320GB; Memory:4096MB
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete and overwrite a write-protected file? Hertz Questions (Windows Mobile) 4 07-25-2008 05:59 PM
Display large text file JamesC Questions (Windows Mobile) 3 03-08-2008 02:45 AM
Struggling with the Icon File format. RandomCoder Questions (Windows Mobile) 2 08-04-2007 07:05 PM
Large Txt or data file tcgoh Questions (Windows Mobile) 4 05-29-2007 01:37 AM
Format of file "SQLDesktop.dll" is invalid. Peter Bug Reports 2 05-03-2007 10:58 AM


All times are GMT. The time now is 06:48 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0