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
Post a Comment