B
Bob Hansen
I am having a very strange problem with StreamWriter and writing to files.
I have a procedure that is called several times to write out seperate files,
each of them uniquely named by date all they way to the one hundred
thousandth of a second. After the data is encrypted and written, the
StreamWriter is closed and the function is returned. This all works fine
and dandy, except when it is called more than once in succession.
Originally, the file append flag in the StreamWriter constructor was
accidentally left to true and I was getting some files where there was two
files worth of data in them. After turning the append flag off, I am
usually short one or two files because it can't append.
I have solved the problem temporarily by putting a Thread.Sleep(100) in
before creating the new StreamWriter object, but with the volume of file
writing that will be occuring when this goes public, it will cause too much
of a slow down. Is there a way to safely write data to a file, close it and
ensure that the next file write isnt going to step on the current one?
Thank you for any help you can provide.
Bob Hansen
I have a procedure that is called several times to write out seperate files,
each of them uniquely named by date all they way to the one hundred
thousandth of a second. After the data is encrypted and written, the
StreamWriter is closed and the function is returned. This all works fine
and dandy, except when it is called more than once in succession.
Originally, the file append flag in the StreamWriter constructor was
accidentally left to true and I was getting some files where there was two
files worth of data in them. After turning the append flag off, I am
usually short one or two files because it can't append.
I have solved the problem temporarily by putting a Thread.Sleep(100) in
before creating the new StreamWriter object, but with the volume of file
writing that will be occuring when this goes public, it will cause too much
of a slow down. Is there a way to safely write data to a file, close it and
ensure that the next file write isnt going to step on the current one?
Thank you for any help you can provide.
Bob Hansen