Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing Odd Amount of Bits

Status
Not open for further replies.

kingkongsr

Programmer
Nov 6, 2005
1
US
I was thinking about learning assemby language, and I was wondering if you can write a file that has an odd amount of bits. Let's say that the file's amount of bits can not be divisible by eight. You see i am interested in a file that can have a variable length of bits; is that possible with any programming language? I think i remember coming across a file that had six bits. It was some type of status file that was used by a download manager. Any insight into this question would be much appreciated. Thank You.
 
Since files are stored in bytes on a disk with every modern operating system that I'm aware of, no file would have anything short of full bytes as its length in bits.

Lee
 
You could simulate the idea though by using a bit length count at the start of the file. The file would be padded to the next byte boundary but the bit length count would allow you to process only the bits you want.


Trojan.
 
And the operating system will pad your number of bytes to the cluster size, so that your 3 bit file might well be 4k or 32k or something equally fantastic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top