TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Fabio Silva
NA
19
827
File is being used by another progam
May 24 2020 9:24 AM
so, i have this info that i want to be written into a new file, but only if the file does't exist,
string farmSettings = @"Includes/Settings/" + arrResult[1] + ".json";
if (!File.Exists(farmSettings))
using (StreamWriter sw = File.CreateText(farmSettings))
{
TextWriter tw = new StreamWriter(farmSettings);
tw.WriteLine("{");
tw.WriteLine("ID: " + arrResult[0]);
tw.WriteLine("res1: False");
tw.WriteLine("res2: False");
tw.WriteLine("res3: False");
tw.WriteLine("res4: False");
tw.WriteLine("res5: False");
tw.WriteLine("act: False");
tw.WriteLine("Getaway: False");
tw.WriteLine("vip: False");
tw.WriteLine("}");
tw.Close();
}
however, its blocking the one timw writing because the file is being used by another program.
what is wrong with my code?
Reply
Answers (
3
)
Difference between internal & private access modifiers in C#
How to code the equal sign button??