c# - How to prepend text to a filestream? -


i'm trying write custom header (text) file , have remove header when releasing file.

i trying:

var data = encoding.unicode.getbytes(headertext); file.setlength(buffer.length + data.length); file.write(data, 0, data.length); //then write rest of file 

and when releasing (to skip header):

var data = encoding.unicode.getbytes(headertext); infile.seek(data.length, seekorigin.begin); 

but doesn't work. first, leaves spaces between header text, , reading returns incorrect data. how best can go achieving this?


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -