|
For some compilers, there is a packing specifier for structs, for example ::
RealView ARM compiler has "__packed" Gnu C Compiler has "__attribute__ ((__packed__))" Visual C++ has no equivalent, it only has the "#pragma pack(1)"
I need something that I...
Started by Malkocoglu on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Endpacked.h"
Then for MSVC, packed.h:
#define PACKED #pragma pack(push,1)
endpacked.h
#pragma pack(popWhy do you need something to go in the struct?
I think #pragma pack(1) is the same, or am I missing") Notably pack....
|
|
Hi all,
I'm attempting to write a basic Tkinter GUI that has a Text widget at the top, then a Button widget left aligned under it, then another Text widget underneath the button. The problem I'm having is, after packing the Button widget to the left, ...
Started by Bryce Thomas on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Packing happens in the order the .pack methods are called, so once x has "claimed" the left side having x packed to the left side at all, but rather having it anchored to the left, using anchor=W that widgets don't have to be children....
|
|
Purpose
I am writing a network program in C (specifically gnu89 ) and I would like to simplify things by reinterpreting a certain struct X as big array of bytes (a.k.a. char ), sending the bytes over the network, and reinterpreting them as struct X on...
Started by Anthony Cuozzo on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
And the documentation for the packed attribute clearly states that only padding/alignment is affected:
The packed attribute specifies:
struct foo { short someField : 16 __....
Addresses that increase in the order in which they are declared .
|
Ask your Facebook Friends
|
Hi, In the Java Swing app I made it seems to me that all the component are too tightly packed.
In QT one can specify padding and margins for the layout.
Is there something similar for swing?
Here is a screen shot of my application that I thing is too ...
Started by kroiz on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Take a look to ....
What LayoutManager are you using? Adding margins is quite easy, it depends however on the specific LayoutManager used .
It allows all kinds of customizations, including margins/paddings.
You could use MiGLayout as your layout manager.
|
|
Hello,
I have some RGB(image) data which is 12 bit. Each R,G,B has 12 bits, total 36 bits. Now i need to club this 12 bit RGB data into a packed data format. I have tried to mention the packing as below:-
At present I have input data as - B0 - 12 bits...
Started by goldenmean on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
It's probably not packing the bytes exactly as you want, but you should get the general....
This is pretty much untested, super messy code I whipped together to give you a start .
Use bitwise & (and), | (or), and shift << , >> operators .
|
|
Hi
What would the best way of unpacking a python string into fields
I have data received from a tcp socket, it is packed as follows, I believe it will be in a string from the socket recv function
It has the following format
uint8 - header
uint8 - length...
Started by mikip on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Is this the best way of doing this or is there a better way
It is likely that there will be strings with other formats which will require a different unpacking scheme
field1 = struct.unpack('B'... .
Use struct module
Take a look at the module ' struct ' .
|
|
I'm trying to optimize the size of my Delphi classes so that they take up as less memory as possible cause I'm creating a great number of them.
The thing is, the classes themselves are pretty small but they aren't taking the space I was expecting. For...
Started by Jorge Córdoba on
, 10 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Note that using packed does cause....
You can pack sets, arrays, records, objects and file types.
Absolutely.
Why not just use packed records to begin with? It would leave out the overhead (slight) caused by descending from TObject...
|
|
I need to read a blob field from a database into a c# app.
However the blob field was written to the database by a Delphi App using the following method:
procedure WriteABlob(Blob : TBlobField; var Buffer; size : integer); var s : String; begin setlength...
Started by JamesB on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
CharSet.Ansi, Pack = 1)] public struct String20 { [MarshalAs(UnmanagedType.U1)] public byte StringSize_header_identifiers)] public String20[] header_identifiers;
Also found that Delphi Packed Boolean.
|
|
I have a series of ASCII flat files coming in from a mainframe to be processed by a C# application. A new feed has been introduced with a Packed Decimal (COMP-3) field, which needs to be converted to a numerical value.
The files are being transferred ...
Started by tsilb on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
A packed field stores each digit in a half byte with the lower half byte of the values in the packed decimal fields: http://www.simotime.com/asc2ebc1.htm
List of code pages in msdn enc = new System.Text.Encoding(....
On the record to ASCII.
|
|
I'm getting files transferred from an AS/400 to our Windows (SBS 2003) via FTP. The files are fixed-width data. The text appears fine, but some of the fields are packed decimals, which when unpacked give bad values. My assumption is that there's an implicit...
Started by Dave on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Typically this translation....
As you found.
Yes the EBCDIC -->> ASCII conversion will screw up packed decimal fields because some of the bytes in the Packed Decimal will get converted to ASCII.
Hope this helps.
But iSeries specific.
|