Mayur  Gujrathi

Mayur Gujrathi

  • 405
  • 3.9k
  • 1m

Creting and writting text file

Dec 2 2011 1:25 AM
Dear friends

I am creating on .txt file like this

FileStream fileStream = new FileStream(@"C:\mayur.txt", FileMode.Create);

file is created

on next line i am trying to initialise one writer

TextWriter sw = new StreamWriter(@"C:\\mayur.txt");

but it is giving error file is being used by another person on this line

when I create file manually and then this code works fine but this i am not creating file in code

How to solve this problem

Answers (1)