Can someone give m a pointer re SD
Moderators: David Barker, Jerry Messina
Can someone give m a pointer re SD
Hi,
Is it possible to set a pointer (on an SD card) before a readbyte/word command or do I have to do X Readbytes to get to my target byte?
I was hoping to use an SD file as a sort of DataBase and would like to get to the target byte as rapidly as possible.
Thanks.
Is it possible to set a pointer (on an SD card) before a readbyte/word command or do I have to do X Readbytes to get to my target byte?
I was hoping to use an SD file as a sort of DataBase and would like to get to the target byte as rapidly as possible.
Thanks.
Francis,
At present, you cannot set a pointer and must read the required number of bytes from the start. However, your requirement is a good one and it shouldn't be too difficult for me to implement and add to the library for you.
Would the following be OK in outline:
i) a command to skip a certain number of bytes (performed much faster than reading this many bytes directly),
ii) a further command to set the pointer at a specific position - if this is past the current position, it will perform a skip as above, but if it is before the current position, it will have to start again at the beginning of the file and skip to the right position from there.
How urgently do you need this?
Regards,
Steven
At present, you cannot set a pointer and must read the required number of bytes from the start. However, your requirement is a good one and it shouldn't be too difficult for me to implement and add to the library for you.
Would the following be OK in outline:
i) a command to skip a certain number of bytes (performed much faster than reading this many bytes directly),
ii) a further command to set the pointer at a specific position - if this is past the current position, it will perform a skip as above, but if it is before the current position, it will have to start again at the beginning of the file and skip to the right position from there.
How urgently do you need this?
Regards,
Steven
I'll have to think about this one carefully. It's something I have thought about doing before, but cried shy of it. Currently you can read OR write, but not both - you open a file for one or the other. Adding the ability to do both is possible, but will require some careful coding so that the file is extended properly if writing occurs at the end etc... I'll have to streamline some of the existing code first, which will be no bad thing, but it will then need careful testing. I'll give it some thought...
Steven
Steven
Sorry Steven,
I (through ignorance) hadn't appreciated the complexity.
Something like:-
Open for reading
Set pointer
Read Byte/Word
Close
Open for writing
Set pointer
Write Byte/Word
Close
is fine, no need for both at once.
And yes (I know) its easy for me to say.
As it sounds like a big job then put it in the suggestion box for a rainy day. No hurry and no worry.
Regards.
I (through ignorance) hadn't appreciated the complexity.
Something like:-
Open for reading
Set pointer
Read Byte/Word
Close
Open for writing
Set pointer
Write Byte/Word
Close
is fine, no need for both at once.
And yes (I know) its easy for me to say.
As it sounds like a big job then put it in the suggestion box for a rainy day. No hurry and no worry.
Regards.
I had been thinking about your app already where you update a config file on an SD card. I am unlikely to make the changes to the PDS version, since it's quite complex, but conceivable in the Swordfish procedural language. If this is of use to you, then great. I'll consider it extra incentive. I've not started re-writing it yet, but I am now working through some ideas.
Regards,
Steven
Regards,
Steven