Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   storing structure(size less than 1 byte) to file (http://www.go4expert.com/forums/storing-structure-size-1-byte-file-t7452/)

sreejith 22Nov2007 14:06

storing structure(size less than 1 byte) to file
 
hi,
Plz replay .............for storing a structure(containing a 4 bit length variable) to a file

shabbir 22Nov2007 17:59

Re: storing structure(size less than 1 byte) to file
 
As you have posted the query in the introduce yourself forum no one can even make a guess which programming language you are looking help in. Help us to help you.

sreejith 23Nov2007 23:53

Re: storing structure(size less than 1 byte) to file
 
hi,
thanks for your attention, C++ is the language which I forget to mention, can I store the structure (<1 byte) without using type casting. ................hoping your replay

shabbir 24Nov2007 14:09

Re: storing structure(size less than 1 byte) to file
 
Moved to C-C++ forum.

Salem 24Nov2007 15:39

Re: storing structure(size less than 1 byte) to file
 
You can't have a struct containing less than 1 byte in C or C++.

I'm guessing you declared a bit-field
Code:

struct foo {
  unsigned int bits : 4;
};

This will ALWAYS be padded to some multiple of the size of a char.

Show us some more of what it is you're trying to do.


All times are GMT +5.5. The time now is 17:42.