Reading text from file to unsigned char array

前端 未结 3 1846
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-01 02:04

I was looking to use OpenSSL to encrypt text in a file, and will need the text to be in an unsigned char array before I encrypt it. What is the easiest way read text from a

3条回答
  •  执念已碎
    2021-01-01 02:35

    There must be a ton of examples online of how to do this. The only tricky part is that you will almost certainly need to dynamically allocate memory for the array in order to guarantee that you do not read more input than can fit in the array. Also, you will need to do more research if you need to process large files (say, several GB or larger) that will not fit into a single array of bytes.

提交回复
热议问题