in reply to Replacing a character in a file

If you really want to get rid of some characters in your data (and I agree with 1nickt++ that perhaps you shouldn't), then it would probably be better to store the result of your query into an array in memory, modify the array to clean it up and then only write the data to a file, rather than writing immediately to a file and then trying to change the file.

Also, it seems that your code is opening the Plants.txt file in write mode, this will clutter the existing file, probably not what you want.