SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Apprentice
    Join Date
    Oct 2001
    Location
    Layton, Utah USA
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    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
    FOpen(hFile, SYNC_ACQ);
    sSearch := sACQ_ID;
    if FFindString(hFile, sSearch) then

    // delete the data (sSearch)
    FCurrentPositionSet(hFRemoveNBytes(hFile, 35);
    File, sSearch, OPT_FILE_BEGIN);
    FRemoveNBytes(hFile, 35);

    // 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?

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Location
    NYC area
    Posts
    463
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    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.
    Yes, it really IS rocket science!
    http://www.linkedin.com/in/doncobos

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:25 PM.

Copyright BetaSoft Inc.