KiyooMTP 发表于 2024-11-13 23:45:40

hw_ctree.xml configuration in .bin?

can i put hw_ctree.xml in .bin file flasher to make epon at the same time load the configuration?

池州老_阮 发表于 2024-11-14 03:11:26

本人不懂英文;顶贴。

zhang260gt 发表于 2024-11-14 03:24:24

you need to convert file content in hw_ctree.xml to binary data as output.bin

Python:

import struct

# to write in
data_to_write = "file content"#file content of hw_ctree.xml

# open .bin to write
with open("output.bin", "wb") as bin_file:
# to binary
   binary_data = data_to_write.encode('utf-8')

# to .bin
    bin_file.write(binary_data)

#So do game over

zhang260gt 发表于 2024-11-14 03:35:33

import struct
with open('hw_ctree.xml', 'r') as file:
    content = file.read()

binary_data = content.encode('utf-8')

with open('output.bin', 'wb') as bin_file:
    bin_file.write(binary_data)

KiyooMTP 发表于 2024-11-14 04:02:26

zhang260gt 发表于 2024-11-14 03:35
import struct
with open('hw_ctree.xml', 'r') as file:
    content = file.read()


whats this what app

chinadslxiaobai 发表于 2024-11-14 09:47:28

python 转二进制。厉害了
页: [1]
查看完整版本: hw_ctree.xml configuration in .bin?