In Silk Test Classic 5.5 SP1 or later, there is no file open mode that allows you to insert information into the beginning of a file. If you use FM_UPDATE, you can read in part of your file before writing, but any write function calls will overwrite the rest of the file.
If you are writing strings rather than structured data, you can use ListRead() and ListWrite() to insert information at the beginning or any other point of a file. Use ListRead() to read the contents of the file into a list, insert the new information at the head or any other point of the list, and use ListWrite() to write it back out.
[-] LIST OF STRING lsNewInfo = {...} [ ] "*New line one*" [ ] "*New line two*" [ ] "*New line three*" [ ] LIST OF STRING lsFile [ ] INTEGER i [ ] [ ] ListRead (lsFile, "{GetProgramDir ()}\Sample.txt") [-] for i = 1 to ListCount (lsNewInfo) [ ] ListInsert (lsFile, i, lsNewInfo[i]) [ ] ListWrite (lsFile, "{GetProgramDir ()}\Sample.txt") [ ]
Sample.txt before the write:
Line 1 Line 2 Line 3 Line 4 Line 5
Sample.txt after:
*New line one* *New line two* *New line three* Line 1 Line 2 Line 3 Line 4 Line 5