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

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

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

javascript - storing input from prompt in array and displaying the array -