-
write in a binary file
hi guys
now the thing is simple
i want to write binary data to a binary file
for example
i wanna get a string length strlen(str)
then convert this length to binary e.g. 2 == 00000010
then write this length to a file as 1 byte "00000010 is one byte "
so i think we will use binary file
the problem is that i don't know how to get the length in binary and how to write this to a file in one byte length
any idea ???
-
1. to write binary file - open file as binary
2. length is longer than 1 byte (4 bytes I suppose) so writing it using bynary write will write (depending on the size of size_t type) 4 bytes to your file...