write a specific offset to an fat16 SD card file?

is it possible to write in to a file in an specific position
grazie

is it possible to write in to a file in an specific position

Using which library? Some have seek() methods that let you position the insert point. Otherwise, your choices are at the start, and then truncate, or at the end.

Keep in mind that writing at a specific point only makes sense for fixed length records.

i use a standard sd.h card

you need only add a byte to a file

Some have seek() methods that let you position the insert point

can you give me an example?
thanks

not sure about the intention of the original question maybe some more explanation?
I'm also interested specific writes, just bumping

maybe there is a good resource to follow that can be recommended? Everything I have found so far revolves around data logging which is relatively simple to figure out.

can you give me an example?

long offset = 0x1034; // Define where to go to
File myFile = SD.open("BigFile.txt");
if(myFIle)
{
   if(myFile.seek(offset))
   {
      // Got to the desired location
   }
   myFile.close();
}

ok, so basically,

long offset = rowxColumn;
correct?

Since there is no situation presented by the op, I'll create one for the sake of furthering the example.
lets say we are dealing with a potentially very large user created word list that has the following intentions for using it
-A function to place the word in the file

  • A function to fetch a word based on the first letter proposed as an argument (then based on a concatenated second letter and so on up to about 4 letters)

The point of the offset being to search the file, reading as little redundant information as possible.
How would one approach creating the "long offset" during run time rather then pre-defining it?

for example the user gives the letters "at" and maybe the file was built by different combinations of letters row by row like so,
abs row 0-absent abstain ect...
at row 1- atone atmel ect...
att row 2-attach attainment attempt ect...

even though "at" only needs to be converted into the column value 1 it seems like seek() takes two arguments consolidated into one long. How would one go about creating "long offset=1x0" after deriving that column value equals lets say "int column=1" & "int row=0". I suppose its not as simple as just using "long( )"?

The only ways that seeking in a file is meaningful are if the file consists of fixed length records or the file has been scanned and key locations noted.

If every record is 80 characters, and the records are known to be in order, one could go to the start of the record in the middle of the file. The record of interest is either at that location, before it, or after it. One goes then to the middle of the half where the record must be, and looks again. Each seek/check operation cuts the range in half. Very quickly, the record of interest can be located.

If the file contains XML data, and the file has been scanned to locate all the tags of a given type, and the location of those tags recorded, one can then step through the file locating the records of interest. Suppose, for instance, that the XML file contains data about authors and the books they have written. If you scan the file, locating author tags, and created two lists, of authors and locations, you could present a list of authors, and, when one was selected, very quickly locate the area of the file where that author's books are stored.

The first pass through the file would not be all that quick, but subsequent uses of the file would be.

However, since OP hasn't defined how sh/she will determine the offset to seek to, we can only discuss possible reasons for what OP might want to do.