[C#] Help with threads and file i/o
I hope I'll be able to delineate exactly what my problem is here. In short, I have 2 threads running side-by-side. Each thread has a file open that is being written to. The program is basically looping to try and find a prime factor (the RSA thing) and I write every nth prime to a file so as to have a backup in case of a crash or needing/wanting to shut down the program.
The problem is, the factors don't seem to write to the files unless it's closed properly (I don't understand this). So, I need to either find a way to close the file by pressing Ctrl+C or something, or I need to find a way to force the factors to be written.
I doubt I've explained the problem properly, but feel free to ask questions about it.
|