Remove strings from file
I have a group of virtual users that write to and read from the same data files (GUID's). At the end of each users' session I need to delete the string out of the shared file. There are no rows, only appended data as each data string is created.
1272062969604D58CF1B5C10F6B0D995~,~127206298171044 4402DA96D5934659C~,~1272062983862A501D221A98505DE2 7C~,~ etc...
Right now I have this:
sACQ_ID := "1272062981710444402DA96D5934659C~,~";
// open the file and search for the data
sSearch := sACQ_ID;
if FFindString(hFile, sSearch) then
// delete the data (sSearch)
File, sSearch, OPT_FILE_BEGIN);
// This does not work because sSearch is a string and not the location (number) value in the file.
Currently, there is no built in functions to delete strings out of a file, only rows and characters from position values. Is it possible to search for a position from a string search?
Re: Remove strings from file
The way I've found to solve this in the past is to abandon the reading and writing from a file and move everything into a database. It's much simpler to delete a row in that fashion. Or you could have a column denoting if a line has been used or not and set a flag telling your retrieval query not to re-use it. Lots of options as to how to implement it, but the short of it is removing data from a flat file in a multi-user environment is very tricky in my experience and a simple database table is much easier to manipulate.