由买买提看人间百态

topics

全部话题 - 话题: slogfile
(共0页)
c*o
发帖数: 70
1
来自主题: DotNet版 - easy question, but ...
Many users will write to the same logfile, how can I make sure there is no
conflict when there are some concurrent access? I can't find a method to check
if the file is open or not.
Would you please add some sample code based on the following code? Thank you
so much!
StreamWriter sw=File.AppendText (sLogFile);
sw.WriteLine (DateTime.Now.ToLongTimeString ()+" "+sText);
sw.Flush ();
sw.Close ();
(共0页)