C# Append byte array to beginning of a file (without loading entire file in memory) -



C# Append byte array to beginning of a file (without loading entire file in memory) -

question: possible (and how?) append byte array existing file without loading entire file in memory.

to more specific: goal transform this:

00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00000010 00 00 10 00 00 00 08 00 08 02 00 00 00 29 f0 61 00000020 e9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17 00000030 12 01 67 9f d2 52 00 00 20 00 49 44 41 54 78 da 00000040 dc bd db 76 24 39 ae 2c 08 f0 e2 1e aa ea f9 ff 00000050 ff 9c 5e a7 53 ee bc 60 1e 8c 80 c3 af 0a 29 b3 00000060 76 ef 33 7a a8 a5 52 46 f8 85 04 41 10 30 33 30 00000070 33 d3 37 7f 44 e4 07 df fa 5f f5 c3 cc 22 f2 f0 00000080 af 97 6f 8a af e0 bb 0f 57 b0 7f 12 22 3e fd fd

into this:

--added bytes 00000000 74 65 73 74 74 65 73 74 74 65 73 74 74 65 73 74 --added bytes 00000010 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00000020 00 00 10 00 00 00 08 00 08 02 00 00 00 29 f0 61 00000030 e9 00 00 00 09 70 48 59 73 00 00 17 12 00 00 17 00000040 12 01 67 9f d2 52 00 00 20 00 49 44 41 54 78 da 00000050 dc bd db 76 24 39 ae 2c 08 f0 e2 1e aa ea f9 ff 00000060 ff 9c 5e a7 53 ee bc 60 1e 8c 80 c3 af 0a 29 b3 00000070 76 ef 33 7a a8 a5 52 46 f8 85 04 41 10 30 33 30 00000080 33 d3 37 7f 44 e4 07 df fa 5f f5 c3 cc 22 f2 f0

i've been trying figure out whole morning, can't seem find working solution. know possible append file @ end without loading file memory, need append beginning.

thanks in advance

simply put, that's not possible. that's not how files work. depending on how it, may not have load whole file memory at same time, need load every single byte of file , write after bytes wrote front.

c# arrays file append byte

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -