file - c# Save Streamwriter after every 200 Cycles without Closing -
i'm using streamwriter write data file.
system.io.streamwriter file = new system.io.streamwriter(path); while(something_is_happening && my_flag_is_true) file.writeline(some_text_goes_inside); file.close();
what noticed is, till close called no data written file.
is there way can save contents file before closing.
for purpose can use flush method.
system.io.streamwriter file = new system.io.streamwriter(path); int counter = 0; while(something_is_happening && my_flag_is_true) { file.writeline(some_text_goes_inside); counter++; if(counter < 200) continue; file.flush(); counter = 0; } file.close();
for more information welcome msdn
Comments
Post a Comment