Hello Team, Here is the higly capable Data Storage Protocol (DSP) I use in my programs. If you work on something that needs to exchange data with my software, it's a very very good idea to be utilizing this module. Those working with VB can utilize the attached copy of the module, those working with other languages can utilize this direct translation from Visual Basic to English and code up an indentical themselves. The functions and subroutines may be out of order and you may not need to implent them all. First of all put togather a comment containing something like the following: --- Begin quote --- +-------------------------------------------+ | ICI style I/O database file access module | +-------------------------------------------+ | Made by Jure Sah of MesonAI | | TimeDateStamp: 19:12 29.1.2002 | +-------------------------------------------+ ---- End quote ---- With appropriate information of course. Then come the parts that the module itself will use. If your programing language requires it (always so), define a type that will be able to hold two strings in one variable. Also define two strings that will hold the temporary files path and the default path. Create a function named xFixName it should accept a string named xName and output a string. Determine if xName is a whole path (or just a filename) and if it turns out to be only a filename, add the default path to make it a whole path. Now return the string you end up with. In case your programing language offers no direct way, you should create your own functions and subroutines for: - Checking if a file exists - Delete a file - Append something to a file - Rename a file - Search a string if it includes another one If your programing language uses filenumbers to keep track of open files, make sure that available filenumbers are automaticaly selected! Now the real stuff! Create a subroutine (function with no return) named xCreate that will input a string named xName. This subroutine should fix the xName with xFixName and verify if the file named xName already exists and if it's found to not exist, create one and put the text "INTERNAL FLAG = EXISTS!" in it. Create a subroutine named xRemove that will input a string named xName. This subroutine should fix xName with xFixName and verify if the file named xName exists and if it does, delete it! Create a subroutine named xSet that will input strings named xName, xProperty and xValue. This subroutine should: - Fix the value of xName with the xFixName function - Construct a pathfilename for a temporary file, that dosen't already exist. - Check if the file under xName exists and create it if it dosen't. - Open the file under xName and read it's contens line by line - Split every line to the thing before the "=" and after it - Check if the stuff before the "=" is indentical to xProperty and if it *isn't* copy it to the temporary file - When finnished, append xPropery followed by a "=" and the xValue to the temporary file - Then simply delete the original (xName) and rename the temporary file to xName Create a function named xQuery that should input strings named xName and xProperty and output a string. This function should fix the xName with xFixName and: - Check if the xName file exists, if it doesn't, return nothing and exit function - Read the xName file line by line - Check each line if it includes xProperty before the "=" sign and when something appropriate is found, return the part after the "=" sign and exit function Create a function named xNextSerial that inputs strings named xName and xProperty and returns a long number. The function should: - Fix the xName with xFixName - Start an unlimited loop and an increasing counter who's value is stored in a long number named N - Use the xQuery function and input it this xName for it's xName and this xProperty with the value of N added for it's xProperty. - Loop until the return of xQuery is empty - When out of the loop, return the current value of N Create a subroutine named xRemoveEntry that inputs strings named xName and xProperty. The subroutine should do everything xSet does, except the finnal part where there is something appended to the temporary file. Create a subroutine named xRemoveSerial that inputs strings named xName, xProperty and xValue. The subroutine should: - Fix xName with xFixName - Get the last serial number using the xNextSerial function (xName and xPropery provided as they are here) - If a value of 0 is returned, exit the subroutine - If a value of 1 is returned, use the xRemoveEntry subroutine to remove the entry (xName provided as is here, xProperty gets an additiona "1" at the end) and exit the subroutine - If a value grater than 1 is returned continue - Find what we need to remove with the xFindSerial function (all values remain as they are here) - Overwrite using the xSet: It's xName is this xName, while it's xProperty the result of the above function and it's xValue, the value gotten via xQuery using the same xName and the xProperty with the value of the last serial number added (last entry). - Remove the last entry via the xRemoveEntry function (same xName and the xProperty with the value of the last serial number added) Create a function named xFindEntry that is inputed strings named xName and xValue and returns a string. It should do the same thing as the xQuery function, just that what is after the "=" sign is sougt and what is before it returned when found. Create a function named xFindSerial that inputed strings named xName, xProperty and xValue. It should return a string. This function should: - Fix the xName with xFixName - Check if the file under xName exists, if it dosen't it should return nothing and exit function - Scroll down the xName file checking if the thing before the "=" in each line *contains* the xProperty and if the thing after the "=" *is* xValue. If return is ok, return the thing before the "=" and exit function Create a function named xQueryByLineNumber that is inputed a string named xName and a long number named xLineNumber. It should return a doubble string (type defined at the start of the module). The function should fix the xName with xFixName and scroll down the file under xName, keeping a count of the lines. When it encounters a linenumber indentical to the given xLineNumber, it should split the line right down the "=" sign and feed both parts in seperate strings as the return. If it does not encounter the requested xLineNumber, it should return blank. All of the above is what I consider to be open source as long as the code is kept in one piece, I am noted as the author and distribution is controled. C'ya! -- Cellphone: 0038631752815 Don't feel bad about asking/telling me anything, I will always gladly reply. Digging for info? Try AI Meta Search: Http://WWW.AIMetaSearch.Com MesonAI -- If nobody else wants to do it, why shouldn't we?(TM) Http://WWW.MesonAI.Com