Writing bits to a file in C

前端 未结 5 373
时光说笑
时光说笑 2021-02-03 22:14

I have this string: \"101\" I want to write it to a file, in C, not as text: \"101\" and so 8 bits x char. but directly use the string as bits: the bit \"1\", the bit \"0\" and

5条回答
  •  星月不相逢
    2021-02-03 23:07

    You are not writing the bits 101, but the binary value of the decimal number 101, ie 1100101. Because you are fread a size of sizeof(x) bytes, your file will be sizeof(x) bytes long.

提交回复
热议问题