CreateFileArray(#File, ArrayName$(Row,Col)) and more !

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
GeBonet
Enthusiast
Enthusiast
Posts: 135
Joined: Fri Apr 04, 2008 6:20 pm
Location: Belgium

CreateFileArray(#File, ArrayName$(Row,Col)) and more !

Post by GeBonet »

New !!!
If you have...
Dim ArrayName$(Row,Col) or Dim ArrayName.s(Row,Col)
And you write data into the array, the most useful to write on disk is !!!
(I Have encontred something similar many year ago (SBasic) on Flex OS... It was very convenient and was lost as a lot of other very useful thing :wink: )
; ----------------------------------------------- --------------------------------------------------
CreateFileArray(#File, ArrayName$(Row,Col))
ReadFileArray(#File, Row, ArrayName$()); Read Row only
ReadFileArray(#File, ALL, ArrayName$()) ; Read All the ArrayName$()

WriteFileArray(#File, Row, ArrayName$()) ; Write the Row only...
WriteFileArray(#File, ALL, ArrayName$()) ; Writes the entire ArrayName$()

And why not...
DeleteFileArray(#File, ROW, ArrayName$()) ; Delete the ROW only
InsertFileArray(#File, ROW, ArrayName$()) ; Insert the ROW only (After the last Read...)

Note : The ROW=0 wil be reserved for the header of the COL...
Wath you thing about that ? :wink:
I now, we can do that with some Lib... But I think it would be quite native in PB ???
Tanks for all !
Sorry for my english :wink: ! (Windows Xp, Vista and Windows 7, Windows 10)
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: CreateFileArray(#File, ArrayName$(Row,Col)) and more !

Post by STARGÅTE »

Read Row only
Write the Row only
Delete the ROW only
Insert the ROW only
It sounds like databases
only that your idea would be inflexible!
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
GeBonet
Enthusiast
Enthusiast
Posts: 135
Joined: Fri Apr 04, 2008 6:20 pm
Location: Belgium

Re: CreateFileArray(#File, ArrayName$(Row,Col)) and more !

Post by GeBonet »

@STARGÅTE
only that your idea would be inflexible!
What I meant by "Row only" it's just like a direct access record, and for example book column "0" as an indicator of locking / unlocking to network on the same file ...
But the interest is to have an array of type "Excel" read / write to disk and also in a very simple form!
I repeat, this type of work existed in the "Sbasic" and disappeared with the "Sbasic" in 85-90 years?
And as everything appeared and disappeared there was often one or the other remarkable thing which unfortunately disappeared too. And it's one of those things ... Who do not even need to open a file, the declaration "FDIM NomArray (Row, Col)" opens automatically on disk management.
Another interesting point, it becomes a no limit Array (except that of the disc), and would save memory since only a portion would be used (the "n" ROW in progress).
It sounds like databases
If you want to, but greater simplicity ...
But hey, it's just an idea ... :lol:
Sorry for my english :wink: ! (Windows Xp, Vista and Windows 7, Windows 10)
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: CreateFileArray(#File, ArrayName$(Row,Col)) and more !

Post by Zach »

There was a tool for Darkbasic that did something similar to this, which I actually found quite useful.

It allowed you to save/load the entire array itself to/from a file (and was not human readable, so good for obfuscation).

Pretty good for a simple database for games, or a small application
Post Reply