c# - The process can't access the file, because it is being used by another process -


संभव डुप्लिकेट:

  का उपयोग करते हुए (स्ट्रीमरलाइटर _SelectedFile = File.CreateText (CConstant.m_TEMPFILEPATH)) {_Sईलेक्टेडफ़ाइल.WriteLine (CConstant.m_SaveFileDefaultDirectory); _SelectedFile.WriteLine (CConstant.Tempfile_ECUSelected); _SelectedFile.WriteLine (CConstant.Tempfile_inifile); _SelectedFile.WriteLine (CConstant.Tempfile_mapfile); _SelectedFile.Flush (); _SelectedFile.Close (); _SelectedFile.Dispose (); }   

कोड चलाने पर, पहली बार जब मैं कोड चलाता हूं (कोई भी temp.txt फ़ाइल नहीं है), तो यह एक अपवाद फेंकता है "प्रक्रिया फ़ाइल तक नहीं पहुंच सकती, क्योंकि यह किसी अन्य प्रक्रिया द्वारा उपयोग किया जा रहा है। "कृपया समाधान का सुझाव दें और कोड को इस तरह लिखने में क्या गलत है?

क्या आप FileStream को FileMode.OpenOrCreate विकल्प से बना सकते हैं? फ़ाइल के बजाय?

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

javascript - What is an alternative to using getElementByClass for hiding multiple elements? -

c - Selecting a file randomly from a file system -