write a program in c# that allows the user to open file Test.text located at "E:/OfficeDocuments/Test.text" the user input string which should be copied to the file
1
Expert's answer
2016-02-18T07:45:09-0500
using System; using System.IO;
namespace stringCopy { class Program { private static void CreateIfNotExist(string pathToFile) { if (File.Exists(pathToFile)) { return; }
private static void AppendToFile(string pathToFile, string content) { // End of string in the end of file File.AppendAllText(pathToFile, content + Environment.NewLine); }
Comments
Leave a comment