RE: lingo-l File IO - how do I erase text in a file? SOLVED...
Gosh! Wouldn't it just be easier to delete the file and then rewriting to it rather than going through all those repeats and stuff? Cordially, Pranav Negandhi New Media Applications. Learnet India Limited, Mumbai. Phone: 91-22-859 8042 Ext: 410 snip I figured out a workaround, clunky as it may be. --- set gTheWriteText = removeQuotes(gTheWriteText) if the last item of gTheWriteText = 3110 then nothing else put SPACE after gTheWriteText end if on removeQuotes dataString repeat with a = 1 to the number of chars in dataString if char a of dataString = QUOTE then delete char a of dataString end repeat . -Steven snip [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
RE: lingo-l File IO - how do I erase text in a file? SOLVED...
Gosh! Wouldn't it just be easier to delete the file and then rewriting to it rather than going through all those repeats and stuff? Easier? Maybe, but as much fun? I say thee nay! =) Deleting the file requires recreating the file and then writing to the file again. What's easier? Running a repeat loop, or doing complex file management? The repeat loop won't fail, whereas the File IO might act up at any time. Best to minimize the work the computer has to do (in this case a 90MHz Pentium I). I might be a victim of superstition here, but it feels like a safer bet to run a repeat loop than have to recreate the file over and over. I am saving CONSTANTLY to this file. Deleting, creating, and writing to a file over and over doesn't seem a good idea. I'm thinking that after thousands of times of doing that, the hard drive would start losing sectors and require defragging. Of course, I'm no hard drive/OS tech, so I'm just guessing. At any rate, it works now, so all is good. Thanks, Steven [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
RE: lingo-l File IO - how do I erase text in a file? SOLVED...
If you really have to do this stuff often, and your strings aren't too long (64k, if I remember correctly) you can try the setPref command. Cordially, Pranav Negandhi New Media Applications. Learnet India Limited, Mumbai. Phone: 91-22-859 8042 Ext: 410 snip Deleting the file requires recreating the file and then writing to the file again. What's easier? Running a repeat loop, or doing complex file management? The repeat loop won't fail, whereas the File IO might act up at any time. Best to minimize the work the computer has to do (in this case a 90MHz Pentium I). I might be a victim of superstition here, but it feels like a safer bet to run a repeat loop than have to recreate the file over and over. I am saving CONSTANTLY to this file. Deleting, creating, and writing to a file over and over doesn't seem a good idea. I'm thinking that after thousands of times of doing that, the hard drive would start losing sectors and require defragging. snip [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
RE: lingo-l File IO - how do I erase text in a file? SOLVED...
sorta... I figured out a workaround, clunky as it may be. --- set gTheWriteText = removeQuotes(gTheWriteText) if the last item of gTheWriteText = 3110 then nothing else put SPACE after gTheWriteText end if on removeQuotes dataString repeat with a = 1 to the number of chars in dataString if char a of dataString = QUOTE then delete char a of dataString end repeat return dataString end --- This puts a space over the 0 where the 3110 would be. But now the last item in the list when it brings it back in will be 321 . So, I just delete the last char of dataString if it = SPACE before putting quotes back into the list. on replaceQuotes dataString if the last char of dataString = SPACE then delete the last char of dataString repeat with a = 1 to the number of items of dataString if char 1 of item a of dataString = SPACE then delete char 1 of item a of dataString put QUOTE before item a of dataString put QUOTE after item a of dataString end repeat return dataString end I just realized, though, that I could have solved that problem differently by just saying string(value(x)) since they are numbers. I hope this helps somebody else. You can retrieve the number of characters in a file using FileIO, so you can easily add a bunch of spaces to the end of your string you are writing and delete them all when you read them: repeat while the last char of dataString = SPACE delete the last char of dataString end repeat -Steven [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]