09-28-2003, 11:31 PM
what is the best file mode for accessing as saving, using intigers and strings
best file mode
|
09-28-2003, 11:31 PM
what is the best file mode for accessing as saving, using intigers and strings
09-29-2003, 12:32 AM
I always use BINARY, and save TYPE arrays. It's the most structured way of accessing.
am an asshole. Get used to it.
09-29-2003, 12:45 PM
Yeah it is a structured way of accessing and storing data. But be warned that you want to handle strings so when you create a data structure which contains strings you have to specify a length. So after you completely store everything in the binary file and you realise that you want to change the length of the strings then it will be troublesome to do that.
09-29-2003, 12:54 PM
Or you could save your data in a text file if you have to store only little amount of data like this:
Australia, 2563511 USA, 45687 Canada, 8798724 China, 44678 ... I mean just some string and then some integer data. Then you dont have to worry about the length of strings. But then again you wouldnt be able to randomly access any record unless you store the data in an array
09-29-2003, 06:28 PM
using binary records not only lets you store integers, but you can store simple fixed length flatfile databases because every record only takes up a certain amount of space.
the only problem is that it pads fixed length strings with null characters so they are a certain length. if you want to compare strings, pull them out and run them through this: Code: function denull$ (text$)
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
09-29-2003, 06:34 PM
You can also use LTRIM$ on the fixed length string before doing a standard comparison....
Antoni
09-29-2003, 06:54 PM
d'oh... thanks antoni, the "easy" solution didn't even cross my mind.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
09-30-2003, 03:02 AM
I was gonna say... toonski, you did a "whitetiger"! :lol: (he made an INSTR function :lol
09-30-2003, 03:56 AM
Byte (BINARY/RANDOM) is best for speed and smaller size.
It's more difficult than OUTPUT/INPUT because you can't edit it in a text file program (notepad). If you figure out what you're going to put, you can make a special program for your manual file I/O...
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
09-30-2003, 06:09 AM
Quote:I was gonna say... toonski, you did a "whitetiger"! :lol: (he made an INSTR function :lolGah! I've done that. I've made a LEFT$, RIGHT$, INSTR, SPACE$, and STRING$ functions before realising that there were built-in functions.
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79][/url]
END OF LINE. |
« Next Oldest | Next Newest »
|