Typedef struct _CardInfo {
Char serial 16 + [1];
Char kind [2 + 1];
Char kind_desc [32].
Int the alive;
Char issuer [17].
Int version;
Char network [5].
Char release_date 8 + [1];
Char expired_date 8 + [1];//due date, the date the YYYYMMDD
Char plate [13 + 1];
Char plate_color [2 + 1];
Char user_type [2 + 1];
Int the balance;
Char balance_hex 8 + [1];
Char on_line_hex [4 + 1];
Char off_line_hex [4 + 1];
Int on_line;
Int off_line;
} CardInfo;
Already defined query card function, pb is written according to the structure of the inside,
Short _stdcall ReadCard (CardInfo * reply)
{
}
But don't know why read information are dislocation,
Call in pb ret=ReadCard (CardInfo * reply)
The structure changed,
But as long as the structure, instead of integer in front, can,
Typedef struct _CardInfo {
Int isGB;
Int the alive;
Int the balance;
Int on_line;
Int off_line;
Char serial 16 + [1];
Char kind [2 + 1];
Char kind_desc [32].
Char issuer [17].
Char network [5].
Char release_date 8 + [1];//enable date (date) (month) (year) YYYYMMDD
Char expired_date 8 + [1];//due date, the date the YYYYMMDD
Char plate [13 + 1];
Char plate_color [2 + 1];
Char user_type [2 + 1];
Char balance_hex 8 + [1];
Char on_line_hex [4 + 1];
Char off_line_hex [4 + 1];
} CardInfo;
But we have PB program is already written, not to modify, can only modify the dynamic library, excuse me each warrior, just don't modify the order of the structure, what's the solution?
CodePudding user response:
PB callsThe function int ReadCard (ref str_cardinfo card_info) library "test. DLL
"
//* * * * * * * * * * * * * * * * * * * * * * * * * * * *
Int RTN
Str_cardinfo lstr_cardinfo
RTN=ReadCard (lstr_cardinfo)
String serialno used to
Long i_balance
Long i_version
String kind
Serialno used to=lstr_cardinfo. S_card_serial
I_balance=lstr_cardinfo. I_balance
I_version=lstr_cardinfo. I_version
Kind.=lstr_cardinfo s_kind_desc
CodePudding user response:
Yourself to count bytes, C int the default is 4 bytes of PB is 2 bytes, the definition of the char array C tail to define a general store \ 0 terminator, and will bring the PB himself, so correspond to the char C serial 16 + [1], PB defined inside a char serial [16]