jsheley

jsheley

  • NA
  • 8
  • 0

File Stream I/O

Oct 25 2004 6:34 PM
I have a bit of code that makes no sense. What appears to happen is that the "OpenFileDialog" varible neutralises the File I/O. Specifially, the code below works as expected. A file named "Master_Sel.txt" is opened, and "TEST_DATA" is written into it. The file is closed. OpenFileDialog LIB_OPEN = new OpenFileDialog( );// //LIB_OPEN.ShowDialog();//<= Problem Child (%$#$@!!) LIB_OPEN.Dispose(); BinaryWriter LIB_File_Writer = new BinaryWriter(File.Open("Master_Sel.txt", FileMode.OpenOrCreate)); LIB_File_Writer.Equals(LIB_File_Writer.BaseStream); LIB_File_Writer.Write("TEST_DATA"); LIB_File_Writer.Flush(); LIB_File_Writer.Close(); When the "//LIB_OPEN.ShowDialog();" line is un-commented, the Open file dialog appears as expected, but there is no file I/O. This also happens with "Filestream" and Stream writer functions. Can some explain to me how to avoid this problem?

Answers (2)