Writing bits to a file in C

前端 未结 5 362
时光说笑
时光说笑 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:13

    Your output file is 4 bytes in length because you're writing an int to the file. On most platforms, an int is 4 bytes in size.

    You won't be able to write less than 1 byte at a time.

提交回复
热议问题