Home > Back-end >  New simple problem, the problem of type conversion
New simple problem, the problem of type conversion

Time:09-16

 
Unsigned char name [64].
Unsigned char sex [8].
Unsigned char nation [12].
Unsigned char birth_day [36].
Unsigned char address [144].
Unsigned char id_number [76].
Unsigned char department [64].
Unsigned char expire_start_day [36].
Unsigned char expire_end_day [36].
Unsigned char reserved [76].
//read id information
Result=dc_ParseTextInfo (handle, 0, text_len, text, name, sex, nation, birth_day, address, id_number, department, expire_start_day, expire_end_day, reserved);

Requirements: the function to return the above variables, the name, sex, should how to write?
I'm in c #, a interface need to c + + package, since this ask


CodePudding user response:

With c # string can, pay attention to the code

CodePudding user response:

Not return?

CodePudding user response:

reference 1/f, the truth is right or wrong response:
c # in string can, pay attention to the code


Can write the function name? Is such as void fun (int a, int b), do not need to implement, I just want to see so many results on how to write? (the name, sex) what about

CodePudding user response:

On the MSDN example of a complete platform invoke

CodePudding user response:

Can use a structure returned to structure object, such as

Typedef struct
{
Unsigned char name [64].
Unsigned char sex [8].
//...
} information;

Infomation fun ()
{
Infomation info;
//...
Return the info;
}

CodePudding user response:

The fifth floor positive solution, using structure

CodePudding user response:

reference 5 floor WhiteCCai reply:
can use structure returns the struct, such as

Typedef struct
{
Unsigned char name [64].
Unsigned char sex [8].
//...
} information;

Infomation fun ()
{
Infomation info;
//...
Return the info;
}


Thank you, again ask, how to put the zhang SAN assigned to unsigned char name [64]? Deposit is to make the name of the value is zhang SAN

CodePudding user response:

refer to 7th floor zzyhost response:
Quote: refer to fifth floor WhiteCCai response:

Can use a structure returned to structure object, such as

Typedef struct
{
Unsigned char name [64].
Unsigned char sex [8].
//...
} information;

Infomation fun ()
{
Infomation info;
//...
Return the info;
}


Thank you, again ask, how to put the zhang SAN assigned to unsigned char name [64]? Zhang SAN is to make a name for the value of the



Directly use "memcpy ()", memcpy (name, "zhang", sizeof (name));
  • Related