.net - How to truncate a file in c#? -


i writing actions done program in c# file using trace.writeln() function. file becoming large. how truncate file when grows 1mb?

textwritertracelistener tracelistener = new textwritertracelistener(file.appendtext("audit.txt")); trace.listeners.add(tracelistener); trace.autoflush = true; 

what should added above block

try play around filestream.setlength

filestream filestream = new filestream(...); filestream.setlength(sizeinbytesnotchars); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -