The process cannot access the file because it is being used by another process.
-
Hi I am writting the following code to write into text file.After Checking whether the file exixt or not ,It is giving the following error.Can any one help. Any solution to this problem would be appreciated. public void Ping(string hostName) { string path; path = @"C:\CheckList\checklist_"+DateTime.Now.ToString("yyyyMMdd")+".txt"; if (!File.Exists(path)) { File.Create(path); } TextWriter tw = new StreamWriter(path,true); Error comes when we create text writer.
-
Hi I am writting the following code to write into text file.After Checking whether the file exixt or not ,It is giving the following error.Can any one help. Any solution to this problem would be appreciated. public void Ping(string hostName) { string path; path = @"C:\CheckList\checklist_"+DateTime.Now.ToString("yyyyMMdd")+".txt"; if (!File.Exists(path)) { File.Create(path); } TextWriter tw = new StreamWriter(path,true); Error comes when we create text writer.
File.Create returns an open stream to the file created, locking it.
Need custom software developed? I do C# development and consulting all over the United States. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane
-
Hi I am writting the following code to write into text file.After Checking whether the file exixt or not ,It is giving the following error.Can any one help. Any solution to this problem would be appreciated. public void Ping(string hostName) { string path; path = @"C:\CheckList\checklist_"+DateTime.Now.ToString("yyyyMMdd")+".txt"; if (!File.Exists(path)) { File.Create(path); } TextWriter tw = new StreamWriter(path,true); Error comes when we create text writer.
-
Hi I am writting the following code to write into text file.After Checking whether the file exixt or not ,It is giving the following error.Can any one help. Any solution to this problem would be appreciated. public void Ping(string hostName) { string path; path = @"C:\CheckList\checklist_"+DateTime.Now.ToString("yyyyMMdd")+".txt"; if (!File.Exists(path)) { File.Create(path); } TextWriter tw = new StreamWriter(path,true); Error comes when we create text writer.