Of which kind are the " binary files " they are talking about? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Of which kind are the " binary files " they are talking about?

https://www.sololearn.com/learn/C/2953/

23rd Sep 2019, 6:54 PM
Gwlanbzh
Gwlanbzh - avatar
6 Respostas
+ 5
Every file is stored as bytes. bytes are values from 0 to 255, each byte value has corresponding 8bit value. byte | 8bit 0 | 00000000 1 | 00000001 2 | 00000010 3 | 00000011 4 | 00000100 8 | 00001000 16 | 00010000 32 | 00100000 64 | 01000000 128 | 10000000 255 | 11111111 The file byte format often contains information about what the file is, rules that tell how the files should work and the file data. Any file can be read as bytes (computer readable), but some files can be read as text (human readable). Files opened in binary mode are read or written in bytes (bytestring), and files opened in text mode are read or written in text (string).
23rd Sep 2019, 8:19 PM
Seb TheS
Seb TheS - avatar
+ 3
SpaceNerd All the files are stored as bytes, but some files can also be read as text, such as program files (.py, .java, .cpp), and many other such as .html, .txt . But not all files can be read in text mode, such as image and audio files would be quite hard to get written as readable text.
24th Sep 2019, 4:35 PM
Seb TheS
Seb TheS - avatar
+ 2
Ok thanks I think this solved my problem
24th Sep 2019, 5:01 PM
Gwlanbzh
Gwlanbzh - avatar
+ 1
~ swim ~ Seb TheS Ok, so you say " binary file " include any non-text file? Nothing more complicated? :)
24th Sep 2019, 4:21 PM
Gwlanbzh
Gwlanbzh - avatar
+ 1
Ok so thanks
24th Sep 2019, 4:29 PM
Gwlanbzh
Gwlanbzh - avatar
0
Seb TheS ~ swim ~ Oh, sorry I just realized that my question was not precise enough... In fact, I knew what were binary files... My question was more like "which type of binary file can I read/write with this method in C?" But I think I understood from your answers that -- tell me if I'm wrong -- any binary file can be read or written, is it that? Again, that's only my fault to have been not enough precise.
24th Sep 2019, 4:55 PM
Gwlanbzh
Gwlanbzh - avatar