MisterNick
Registered Member
- Oct 22, 2014
- 80
- 61
Hello guys,
I'm trying to create a file if it's not exists and then write some string to it.But i'm getting an error message "the process cannot access the file because it is being used by another process".
if (File.Exists(file))
{
}
else { File.Create(file);
File.SetAttributes(file, FileAttributes.Hidden);
using (StreamWriter writer = new StreamWriter(file, true))
{
writer.Write("3600");
writer.Close();
}
}
Once program will create the file now it's time to write something to the file.And when program is on writing function it's showing an error message
I'm trying to create a file if it's not exists and then write some string to it.But i'm getting an error message "the process cannot access the file because it is being used by another process".
if (File.Exists(file))
{
}
else { File.Create(file);
File.SetAttributes(file, FileAttributes.Hidden);
using (StreamWriter writer = new StreamWriter(file, true))
{
writer.Write("3600");
writer.Close();
}
}
Once program will create the file now it's time to write something to the file.And when program is on writing function it's showing an error message