Monday, 15 July 2013

io - Printing bits in a buffer with C? -



io - Printing bits in a buffer with C? -

what best way in c write , read to/from file specific amount of bits @ time first 16 bits or 12 of lower half of integer. can't seem find threads or documentation on other utilize fwrite. may not sure not think can write specific amount of bits , need buffer can direct me in right way perform this?

with available apis, smallest amount of info can write in file @ time 1 byte. accomplish want, have read byte file, modify using bitwise operators , write file. in case writing info stream, have phone call fwrite 1 time each byte finish or if done. have pad lastly byte zeros or ones whichever more appropriate in view of fact file scheme maintain track of file size in bytes. otherwise require file scheme provides bit level operations , corresponding back upwards @ operating scheme level.

in fact, smallest physical amount of info can written disk sector of 512 bytes , more 4096 bytes. @ file scheme level, several sectors bundled block. operating scheme "hides" fact , allows deal individual bytes.

what seems create question sound stupid fact used current file abstraction has become sec nature. however, behind scenes lot going on back upwards illusion.

c io fwrite

No comments:

Post a Comment