Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Edit file C#

using System.IO;

public void EditorialResponse(string fileName, string word, string replacement, string saveFileName)
{
    StreamReader reader = new StreamReader(directory + fileName);
    string input = reader.ReadToEnd();

    using (StreamWriter writer = new StreamWriter(directory + saveFileName, true))
    {
        {
            string output = input.Replace(word, replacement);
            writer.Write(output);                     
        }
        writer.Close();
    }
}

//Thanks to Michael on StackOverflow
 
PREVIOUS NEXT
Tagged: #Edit #file
ADD COMMENT
Topic
Name
8+1 =