1: #include <stdio.h>
2: #include <stdlib.h>
3: #include <string.h>
4:
5: typedef struct {
6: char IssueKey[16];
7: char SecExKbn[1];
8: char MktKbn[2];
9: char IssueCd[12];
10: char IssueKbn[4];
11: char Filter_1[5];
12: long long Irate;
13: long long RepP;
14: char YldRstrn[1];
15: } LAA01_t;
16:
17: const static LAA01_t init_value = {
18: {0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20},
19: {0x20},
20: {0x20,0x20},
21: {0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20},
22: {0x20,0x20,0x20,0x20},
23: {0x20,0x20,0x20,0x20,0x20},
24: 0,
25: 0,
26: {0x20}
27: };
28:
29: const static char init_value_char[sizeof(LAA01_t)] ={
30: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
31: 0x20,
32: 0x20,0x20,
33: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
34: 0x20,0x20,0x20,0x20,
35: 0x20,0x20,0x20,0x20,0x20,
36: 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37: 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
38: 0x20
39: };
40:
41:
42:
43: void assign_operator(LAA01_t *t1, const LAA01_t *t2){
44: *t1=*t2;
45: }
46:
47: void assign_memcpy(LAA01_t *t1, const LAA01_t *t2){
48: memcpy(t1,t2,sizeof(LAA01_t));
49: }
50:
51: void assign_memcpy_char(LAA01_t *t1, const char *c){
52: memcpy(t1,c,sizeof(LAA01_t));
53: }
54:
55:
56: int main(int argc, char** argv) {
57: LAA01_t t1, t2, t3;
58:
59: assign_operator(&t1,&init_value);
60: assign_memcpy_char(&t2,init_value_char);
61: assign_memcpy(&t3,&init_value);
62:
63: printf("%s[end]\n",t1.IssueKey);
64: printf("%s[end]\n",t2.IssueKey);
65: printf("%s[end]\n",t3.IssueKey);
66: return (EXIT_SUCCESS);
67: }
68:
最近のコメント