1

i want read & copy all bytes from txt file:

char * my_bytes = txtfile.txt; // for example
unsigned char binary[] = { my_bytes};

inside txtfile.txt: // its about 120 bytes

0x41, 0x10, 0xF0, 0x50 etc...

I know how to read file, but can't figure out how to copy it into binary and binary should be :

binary[120] = { my_bytes }

thanks in advance

Ken White
  • 123,280
  • 14
  • 225
  • 444
F. Q
  • 11
  • 2
  • Does this answer your question? [How can I convert hexadecimal numbers to binary in C++?](https://stackoverflow.com/questions/483609/how-can-i-convert-hexadecimal-numbers-to-binary-in-c) – Ken White Apr 25 '20 at 20:13
  • 1
    You're reading hex values into a character array. Read them as bytes instead. Then convert the hex values into binary using the link I provided. – Ken White Apr 25 '20 at 20:14
  • It isn't clear what the problem is. Please post a [mcve]. – n. m. could be an AI Apr 25 '20 at 20:23

0 Answers0