#include <stdio.h>

#include <string.h>

#include <stdlib.h>

 

#define MAX_ADDRESS_CNT 200

 

struct st_basic_trade

{

    char dataclass[2];

    char infoclass[2];

    char marketclass[1];

    char stockcode[12];

    char serialno[8];

    char abbrstockcode[9];

    char abbrstocknamekor[40];

    char abbrstocknameeng[40];

    char senddate[8];

    char infodivisiongroupno[5];

    char stockgroupid[2];

    char isunittrade[1];

    char exclasscode[2];

    char facevaluechangeclasscode[2];

    char isopenpricebasedstandardprice[1];

    char isrevaluationstockreason[2];

    char isstandardpricechangestock[1];

    char israndomendpossibillty[1];

    char ismarketalarmdangernotice[1];

    char marketalarmclasscode[2];

    char iscorporategovernancefine[1];

    char ismanagementstock[1];

    char isinsinceritypublicnewsappoint[1];

    char isbackdoorlisting[1];

    char istradestop[1];

    char indexbusinesstypelarge[3];

    char indexbusinesstypemedium[3];

    char indexbusinesstypesmall[3];

    char standardindustrycode[10];

    char businesstypekospi200[1];

    char listpricesizecode[1];

    char ismanufactureindustry[1];

    char iskrx100stock[1];

    char isdividendindexstock[1];

    char iscorporategovernanceindexstock[1];

    char investorganclasscode[2];

    char iskospi[1];

    char iskospi100[1];

    char iskospi50[1];

    char iskrxsectorindexcar[1];

    char iskrxsectorindexsemiconductor[1];

    char iskrxsectorindexbio[1];

    char iskrxsectorindexfinance[1];

    char iskrxsectorindexit[1];

    char iskrxsectorindexenergychemical[1];

    char iskrxsectorindexsteel[1];

    char iskrxsectorindexnecessary[1];

    char iskrxsectorindexmediacomm[1];

    char iskrxsectorindexconstruction[1];

    char iskrxsectorindexfinanceservice[1];

    char iskrxsectorindexstock[1];

    char iskrxsectorindexship[1];

    char standardprice[9];

    char ydayclosepriceclasscode[1];

    char ydaycloseprice[9];

    char ydayaccmvolume[12];

    char ydayaccmamount[18];

    char uplimitprice[9];

    char downlimitprice[9];

    char substituteprice[9];

    char facevalue[12];

};

 

struct st_basic_ex_trade

{

    char dataclass[2+1];

    char infoclass[2+1];

    char marketclass[1+1];

    char stockcode[12+1];

    char serialno[8+1];

    char abbrstockcode[9+1];

    char abbrstocknamekor[40+1];

    char abbrstocknameeng[40+1];

    char senddate[8+1];

    char infodivisiongroupno[5+1];

    char stockgroupid[2+1];

    char isunittrade[1+1];

    char exclasscode[2+1];

    char facevaluechangeclasscode[2+1];

    char isopenpricebasedstandardprice[1+1];

    char isrevaluationstockreason[2+1];

    char isstandardpricechangestock[1+1];

    char israndomendpossibillty[1+1];

    char ismarketalarmdangernotice[1+1];

    char marketalarmclasscode[2+1];

    char iscorporategovernancefine[1+1];

    char ismanagementstock[1+1];

    char isinsinceritypublicnewsappoint[1+1];

    char isbackdoorlisting[1+1];

    char istradestop[1+1];

    char indexbusinesstypelarge[3+1];

    char indexbusinesstypemedium[3+1];

    char indexbusinesstypesmall[3+1];

    char standardindustrycode[10+1];

    char businesstypekospi200[1+1];

    char listpricesizecode[1+1];

    char ismanufactureindustry[1+1];

    char iskrx100stock[1+1];

    char isdividendindexstock[1+1];

    char iscorporategovernanceindexstock[1+1];

    char investorganclasscode[2+1];

    char iskospi[1+1];

    char iskospi100[1+1];

    char iskospi50[1+1];

    char iskrxsectorindexcar[1+1];

    char iskrxsectorindexsemiconductor[1+1];

    char iskrxsectorindexbio[1+1];

    char iskrxsectorindexfinance[1+1];

    char iskrxsectorindexit[1+1];

    char iskrxsectorindexenergychemical[1+1];

    char iskrxsectorindexsteel[1+1];

    char iskrxsectorindexnecessary[1+1];

    char iskrxsectorindexmediacomm[1+1];

    char iskrxsectorindexconstruction[1+1];

    char iskrxsectorindexfinanceservice[1+1];

    char iskrxsectorindexstock[1+1];

    char iskrxsectorindexship[1+1];

    char standardprice[9+1];

    char ydayclosepriceclasscode[1+1];

    char ydaycloseprice[9+1];

    char ydayaccmvolume[12+1];

    char ydayaccmamount[18+1];

    char uplimitprice[9+1];

    char downlimitprice[9+1];

    char substituteprice[9+1];

    char facevalue[12+1];

 

int  diff;

};

 

void insert_into_st_basic_ex_trade(struct st_basic_ex_trade *st_basic_ex_trade_tmp, struct st_basic_trade st_basic_trade_tmp);

 

char *trim(char *str)

{

int kk;

static char resultstr[1024];

 

memset(resultstr,0x00,sizeof(resultstr));

strcpy(resultstr, str);

 

for(kk=strlen(resultstr)-1; kk>=0; kk--)

{

if(resultstr[kk] != 0x20) break;

else resultstr[kk]=0x00;

}

return(resultstr);

}

 

int main(int argc, char *argv[])

{

    struct st_basic_trade st_basic_trade;

struct st_basic_ex_trade st_basic_ex_trade[MAX_ADDRESS_CNT];

 

char *address_byte[MAX_ADDRESS_CNT];//st_basic_ex_trade structure address saving pointer array

char *address_byte_tmp;//st_basic_ex_trade structure address saving pointer

 

    struct st_basic_ex_trade *address_ex_byte_trade1;//data invert from st_basic_ex_trade structure address saving pointer

struct st_basic_ex_trade *address_ex_byte_trade2;//data invert from st_basic_ex_trade structure address saving pointer

struct st_basic_ex_trade *address_ex_byte_trade_tmp;//data invert from st_basic_ex_trade structure address saving pointer

 

    FILE *fp=NULL;//file pointer

char rbuf[4096];//file read buffer

 

char tmp1[200];

char tmp2[200];

int ii,kk,continue_tmp;

 

if((fp=fopen("BATCH_A0011.dat", "rt"))==NULL)

{

return(-1);

}

 

    //DATA MEMORY INIT

//DATA MEMORY INIT

//DATA MEMORY INIT

//DATA MEMORY INIT

for(kk=0; kk<MAX_ADDRESS_CNT; kk++)

{

memset(&st_basic_ex_trade[kk],0x00,sizeof(st_basic_ex_trade[kk]));

}

 

    //DATA LOAD FROM FILE

//DATA LOAD FROM FILE

//DATA LOAD FROM FILE

//DATA LOAD FROM FILE

    kk=0;

while(1)

{

memset(rbuf,0x00,sizeof(rbuf));

if(fgets(rbuf,sizeof(rbuf),fp)==NULL) break;

 

memcpy(&st_basic_trade, rbuf, (int)sizeof(st_basic_trade));

 

continue_tmp=-1;

 

if(memcmp(st_basic_trade.stockgroupid,"ST",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"EF",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"RT",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"MF",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"SC",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"IF",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"DR",2)==0) continue_tmp=100;

        if(memcmp(st_basic_trade.stockgroupid,"FS",2)==0) continue_tmp=100;

    if(memcmp(st_basic_trade.stockgroupid,"EN",2)==0) continue_tmp=100;

 

if(continue_tmp<0) continue;

 

insert_into_st_basic_ex_trade(&st_basic_ex_trade[kk], st_basic_trade);

kk++;

 

if(kk==MAX_ADDRESS_CNT) break;

}

if(fp != NULL) fclose(fp);

 

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

//POINTER MEMORY USE INSTEAD OF STRUCTURE STACK MEMORY

for(kk=0; kk<MAX_ADDRESS_CNT; kk++)

{

address_byte[kk] = (char *)&st_basic_ex_trade[kk];

}

 

    //DESCENDING BY POINTER MEMORY

//DESCENDING BY POINTER MEMORY

for(kk=0; kk<MAX_ADDRESS_CNT; kk++)

{

for(ii=kk+1; ii<MAX_ADDRESS_CNT; ii++)

{

address_ex_byte_trade1 = (struct st_basic_ex_trade *)address_byte[kk];

address_ex_byte_trade2 = (struct st_basic_ex_trade *)address_byte[ii];

 

memset(tmp1,0x00,sizeof(tmp1));

memset(tmp2,0x00,sizeof(tmp2));

 

sprintf(tmp1, "%.*s", (int)sizeof(address_ex_byte_trade1->standardprice), 

address_ex_byte_trade1->standardprice);

sprintf(tmp2, "%.*s", (int)sizeof(address_ex_byte_trade2->standardprice), 

address_ex_byte_trade2->standardprice);

 

if(atoi(tmp1) > atoi(tmp2))

{

address_byte_tmp=address_byte[kk];

address_byte[kk]=address_byte[ii];

address_byte[ii]=address_byte_tmp;

}

}

}

 

    //STANDARDPRICE DIFFERENCE CALC

//STANDARDPRICE DIFFERENCE CALC

//STANDARDPRICE DIFFERENCE CALC

//STANDARDPRICE DIFFERENCE CALC

for(kk=MAX_ADDRESS_CNT-1; kk>=1; kk--)

{

address_ex_byte_trade1 = (struct st_basic_ex_trade *)address_byte[kk+0];

address_ex_byte_trade2 = (struct st_basic_ex_trade *)address_byte[kk-1];

 

memset(tmp1,0x00,sizeof(tmp1));

memset(tmp2,0x00,sizeof(tmp2));

 

sprintf(tmp1,"%.*s", (int)sizeof(address_ex_byte_trade1->standardprice), address_ex_byte_trade1->standardprice);

sprintf(tmp2,"%.*s", (int)sizeof(address_ex_byte_trade2->standardprice), address_ex_byte_trade2->standardprice);

 

address_ex_byte_trade1->diff = atoi(tmp1) - atoi(tmp2);

}

address_ex_byte_trade1 = (struct st_basic_ex_trade *)address_byte[0];

address_ex_byte_trade1->diff=0;

 

    //RESULT DISPLAY

//RESULT DISPLAY

//RESULT DISPLAY

//RESULT DISPLAY

//RESULT DISPLAY

for(kk=0; kk<MAX_ADDRESS_CNT; kk++)

{

address_ex_byte_trade_tmp = (struct st_basic_ex_trade *)address_byte[kk];

#if(1)

printf("[%.4d]:"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "[%.7d]"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "(%s)"

   "\n", 

kk+1,

address_ex_byte_trade_tmp->iskospi,

address_ex_byte_trade_tmp->dataclass,

address_ex_byte_trade_tmp->infoclass,

address_ex_byte_trade_tmp->serialno,

address_ex_byte_trade_tmp->stockgroupid,

address_ex_byte_trade_tmp->abbrstockcode,

address_ex_byte_trade_tmp->standardprice,

address_ex_byte_trade_tmp->diff,

address_ex_byte_trade_tmp->ydayaccmvolume,

address_ex_byte_trade_tmp->ydayaccmamount,

address_ex_byte_trade_tmp->uplimitprice,

address_ex_byte_trade_tmp->downlimitprice,

trim(address_ex_byte_trade_tmp->abbrstocknameeng));

#endif

}

return(0);

}

 

/*결과

[0146]:(Y)(A0)(01)(00000080)(ST)(A001060  )(000040300)[0002150](000000157559)(000000006374627600)(000052300)(000028250)(JWPHARMA)

[0147]:(Y)(A0)(01)(00000082)(ST)(A001067  )(000042550)[0002250](000000000536)(000000000022519300)(000055300)(000029800)(JWPHARMA(2PB))

[0148]:(Y)(A0)(01)(00000063)(ST)(A000725  )(000043150)[0000600](000000000564)(000000000024648550)(000056000)(000030250)(HyundaiEng&Con(1P))

[0149]:(Y)(A0)(01)(00000039)(ST)(A000270  )(000043550)[0000400](000001342543)(000000058170323500)(000056600)(000030500)(KiaMtr)

[0150]:(Y)(A0)(01)(00000147)(ST)(A002170  )(000044500)[0000950](000000010952)(000000000488631300)(000057800)(000031150)(SamyangTongsang)

[0151]:(Y)(A0)(01)(00000163)(ST)(A002420  )(000045400)[0000900](000000001276)(000000000057439100)(000059000)(000031800)(Century)

[0152]:(Y)(A0)(01)(00000126)(ST)(A001745  )(000045750)[0000350](000000001253)(000000000058412550)(000059400)(000032050)(SKNetworks(1P))

[0153]:(Y)(A0)(01)(00000124)(ST)(A001725  )(000046950)[0001200](000000000551)(000000000025664750)(000061000)(000032900)(ShinyoungSecu(1P))

[0154]:(Y)(A0)(01)(00000123)(ST)(A001720  )(000049550)[0002600](000000002054)(000000000101791900)(000064400)(000034700)(ShinyoungSecu)

[0155]:(Y)(A0)(01)(00000030)(ST)(A000157  )(000050500)[0000950](000000000118)(000000000005902400)(000065600)(000035400)(DOOSAN(2PB))

[0156]:(Y)(A0)(01)(00000067)(ST)(A000850  )(000050800)[0000300](000000001558)(000000000079929400)(000066000)(000035600)(HMT)

[0157]:(Y)(A0)(01)(00000029)(ST)(A000155  )(000051000)[0000200](000000001053)(000000000053774400)(000066300)(000035700)(DOOSAN(1P))

[0158]:(Y)(A0)(01)(00000192)(ST)(A003030  )(000051800)[0000800](000000009657)(000000000494291400)(000067300)(000036300)(SeAhStl)

[0159]:(Y)(A0)(01)(00000073)(ST)(A000950  )(000053000)[0001200](000000001352)(000000000072137200)(000068900)(000037100)(Chonbang)

[0160]:(Y)(A0)(01)(00000156)(ST)(A002320  )(000053200)[0000200](000000053672)(000000002833688300)(000069100)(000037300)(HanjinTrnspt)

[0161]:(Y)(A0)(01)(00000196)(ST)(A003080  )(000055200)[0002000](000000000851)(000000000046476300)(000071700)(000038700)(SungboChem)

[0162]:(Y)(A0)(01)(00000083)(ST)(A001070  )(000056400)[0001200](000000001586)(000000000088415000)(000073300)(000039500)(TaihanTextl)

[0163]:(Y)(A0)(01)(00000137)(ST)(A001940  )(000058300)[0001900](000000002805)(000000000163564100)(000075700)(000040900)(KISCO Holdings)

[0164]:(Y)(A0)(01)(00000114)(ST)(A001530  )(000059200)[0000900](000000001443)(000000000085351600)(000076900)(000041500)(Dongil)

[0165]:(Y)(A0)(01)(00000197)(ST)(A003090  )(000063200)[0004000](000000007172)(000000000457728500)(000082100)(000044300)(Daewoong)

[0166]:(Y)(A0)(01)(00000057)(ST)(A000650  )(000063600)[0000400](000000000824)(000000000053056100)(000082600)(000044600)(ChunilExp)

[0167]:(Y)(A0)(01)(00000140)(ST)(A002020  )(000070600)[0007000](000000044170)(000000003133398600)(000091700)(000049500)(KOLON CORP)

[0168]:(Y)(A0)(01)(00000028)(ST)(A000150  )(000072400)[0001800](000000117697)(000000008567840400)(000094100)(000050700)(DOOSAN)

[0169]:(Y)(A0)(01)(00000055)(ST)(A000590  )(000072600)[0000200](000000001684)(000000000122223400)(000094300)(000050900)(CSHOLDINGS)

[0170]:(Y)(A0)(01)(00000032)(ST)(A000210  )(000077600)[0005000](000000148934)(000000011570941400)(000100500)(000054400)(DaelimInd)

[0171]:(Y)(A0)(01)(00000020)(ST)(A000075  )(000077800)[0000200](000000000177)(000000000013515400)(000101000)(000054500)(SAMYANGHOLDINGS(1P))

[0172]:(Y)(A0)(01)(00000048)(ST)(A000480  )(000080600)[0002800](000000000412)(000000000033291100)(000104500)(000056500)(ChosunRefrctr)

[0173]:(Y)(A0)(01)(00000179)(ST)(A002795  )(000087500)[0006900](000000052984)(000000004654231400)(000113500)(000061300)(AmoreG(1P))

[0174]:(Y)(A0)(01)(00000205)(ST)(A003300  )(000094800)[0007300](000000020468)(000000001954590400)(000123000)(000066400)(HanilCement)

[0175]:(Y)(A0)(01)(00000142)(ST)(A002030  )(000098300)[0003500](000000000761)(000000000074790600)(000127500)(000068900)(ASIA HOLDINGS)

[0176]:(Y)(A0)(01)(00000198)(ST)(A003120  )(000107500)[0009200](000000000483)(000000000051978500)(000139500)(000075500)(IlsungPharm)

[0177]:(Y)(A0)(01)(00000119)(ST)(A001630  )(000120000)[0012500](000000020708)(000000002442273500)(000156000)(000084000)(CHONGKUNDANG HOLDINGS)

[0178]:(Y)(A0)(01)(00000079)(ST)(A001045  )(000135000)[0015000](000000002881)(000000000387653500)(000175500)(000094500)(CJ(1P))

[0179]:(Y)(A0)(01)(00000200)(ST)(A003200  )(000148000)[0013000](000000001833)(000000000268996500)(000192000)(000104000)(IlshinSpng)

[0180]:(Y)(A0)(01)(00000178)(ST)(A002790  )(000161000)[0013000](000000715462)(000000113395522000)(000209000)(000113000)(AmoreG)

[0181]:(Y)(A0)(01)(00000167)(ST)(A002600  )(000161000)[0000000](000000000169)(000000000027542500)(000209000)(000113000)(CHOHEUNG)

[0182]:(Y)(A0)(01)(00000019)(ST)(A000070  )(000177000)[0016000](000000028579)(000000005043584000)(000230000)(000124000)(SAMYANGHOLDINGS)

[0183]:(Y)(A0)(01)(00000182)(ST)(A002840  )(000179000)[0002000](000000000063)(000000000011328500)(000232500)(000125500)(MiwonComcl)

[0184]:(Y)(A0)(01)(00000086)(ST)(A001130  )(000184000)[0005000](000000000647)(000000000119095000)(000239000)(000129000)(DaehanFlrMill)

[0185]:(Y)(A0)(01)(00000024)(ST)(A000105  )(000190000)[0006000](000000000029)(000000000005484500)(000247000)(000133000)(Yuhan(1P))

[0186]:(Y)(A0)(01)(00000066)(ST)(A000815  )(000195000)[0005000](000000003175)(000000000613795000)(000253500)(000136500)(SamsungF&MIns(1P))

[0187]:(Y)(A0)(01)(00000105)(ST)(A001465  )(000198500)[0003500](000000000076)(000000000015081500)(000258000)(000139000)(BYC(1P))

[0188]:(Y)(A0)(01)(00000017)(ST)(A000050  )(000203000)[0004500](000000001581)(000000000318739000)(000263500)(000142500)(Kyungbang)

[0189]:(Y)(A0)(01)(00000056)(ST)(A000640  )(000214000)[0011000](000000013643)(000000002898145500)(000278000)(000150000)(Donga Socio Holdings)

[0190]:(Y)(A0)(01)(00000025)(ST)(A000120  )(000216000)[0002000](000000029404)(000000006392050500)(000280500)(000151500)(CJ korea express)

[0191]:(Y)(A0)(01)(00000078)(ST)(A001040  )(000281500)[0065500](000000039434)(000000011175365500)(000365500)(000197500)(CJ)

[0192]:(Y)(A0)(01)(00000065)(ST)(A000810  )(000303500)[0022000](000000038064)(000000011500917820)(000394500)(000212500)(SamsungF&MIns)

[0193]:(Y)(A0)(01)(00000023)(ST)(A000100  )(000330000)[0026500](000000030710)(000000010129506500)(000429000)(000231000)(Yuhan)

[0194]:(Y)(A0)(01)(00000160)(ST)(A002380  )(000432000)[0102000](000000014528)(000000006278496500)(000561000)(000302500)(KCC)

[0195]:(Y)(A0)(01)(00000187)(ST)(A002960  )(000485000)[0053000](000000000772)(000000000378426000)(000630000)(000339500)(HankookShellOil)

[0196]:(Y)(A0)(01)(00000104)(ST)(A001460  )(000532000)[0047000](000000000326)(000000000172720000)(000691000)(000373000)(BYC)

[0197]:(Y)(A0)(01)(00000059)(ST)(A000670  )(000931000)[0399000](000000001930)(000000001790511000)(001210000)(000652000)(Youngpoong)

[0198]:(Y)(A0)(01)(00000153)(ST)(A002270  )(000943000)[0012000](000000003189)(000000002984664000)(001225000)(000661000)(LotteFood)

[0199]:(Y)(A0)(01)(00000203)(ST)(A003240  )(000986000)[0043000](000000000664)(000000000656189000)(001281000)(000691000)(TaekwangInd)

[0200]:(Y)(A0)(01)(00000134)(ST)(A001800  )(001028000)[0042000](000000010402)(000000010702212000)(001336000)(000720000)(ORION)

bash-3.1$

bash-3.1$

bash-3.1$

bash-3.1$

*/

/*

A0011HK000005032500000001A900050  중국원양자원                            CHINA OCEAN                             2016020400002FSN0000N00N1N00NNNNN000000000137105    00NN    NNNNNNN NN NN NN000003305100000330500000228404100000000751338750500000429500000231500000231000000000000000000310020090522000000096359369N+000000000+000000N+000004765+000069NY00000000N0000000                                000000000000000000001125666856000Y0000700007000010000700001000N0000000000000000000000000000000100001                      HKD344NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR5707017R9700000002F707017R9동양 강남대 1호                         TongYang Kangnam 1                      2016020400002BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000005000300000500000000000000000000000000000000000000650000000350000000352000000500000000000500020051209000000001010764N+000000000+000000 +000000000+000000 N00000000 00000002005091420170913                000000000000000000005053820000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR5713017R3800000003F713017R3산은건대사랑1-1                         KDBKonkukAsset1-1                       2016020400003BCN0000N00N1N00NNNNN                      N  03NNNNNNN NN NN NN000005070300000507000000000000000000000000000000000000659000000355000000351000000500000000000500020050520000000002039243N+000000000+000000 +000000000+000000 N00000000 00000002005032820230327                000000000000000000010196215000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR571301A1B400000004F71301A1BKDB월지급식안심튼튼제2호                KDB Anshim TeunTeun Fund No.2           2016020400004BCN0000N00N1N00NNNNN                      N  01NNNNNNN NN NN NN000000815300000081500000000000000000000000000000000000105500000057100000066000000100000000000100020120224000000010605957N+000000000+000000 +000000000+000000 N00000000 00000002011112820211128                000000000000000000010605957000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR5713027R3600000005F713027R3산은건대사랑1-2                         KDBKonkukAsset1-2                       2016020400005BCN0000N00N1N00NNNNN                      N  03NNNNNNN NN NN NN000005050300000505000000000000000000000000000000000000656000000354000000351000000500000000000500020050520000000000620572N+000000000+000000 +000000000+000000 N00000000 00000002005032820230327                000000000000000000003102860000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR5713037R3400000006F713037R3산은건대사랑2                           KDBKonkukAsset2                         2016020400005BCN0000N00N1N00NNNNN                      N  03NNNNNNN NN NN NN000005060300000506000000000000000000000000000000000000657000000355000000351000000500000000000500020050520000000002001000N+000000000+000000 +000000000+000000 N00000000 00000002005032820230327                000000000000000000010005000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR571901A58600000007F71901A58KB서울햇빛발전소특별자산                KB Seoul Solar Special Asset            2016020400004BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000001015300000101500000000000000000000000000000000000131500000071500000070000000100000000000100020151022000000008180797N+000000000+000000 +000000000+000000 N00000000 00000002015081720180703                000000000000000000008180797000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR572501A3B600000008F72501A3B신한BNPP서울시지하철9호선1호            SHBNPP Seoul Metro 9 No.1               2016020400003BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000001020300000102000000000000000000000000000000000000132500000071500000070000000100000000000100020140221000000025000000N+000000000+000000 +000000000+000000 N00000000 00000002013112720180214                000000000000000000025000000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR572502A3B500000009F72502A3B신한BNPP서울시지하철9호선2호            SHBNPP Seoul Metro 9 No.2               2016020400002BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000001050300000105000000000000000000000000000000000000136500000073500000070000000100000000000100020140221000000025000000N+000000000+000000 +000000000+000000 N00000000 00000002013112720190214                000000000000000000025000000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR572503A3B400000010F72503A3B신한BNPP서울시지하철9호선3호            SHBNPP Seoul Metro 9 No.3               2016020400001BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000001000300000100000000000000000000000000000000000000130000000070000000070000000100000000000100020140221000000025000000N+000000000+000000 +000000000+000000 N00000000 00000002013112720200214                000000000000000000025000000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR572504A3B300000011F72504A3B신한BNPP서울시지하철9호선4호            SHBNPP Seoul Metro 9 No.4               2016020400001BCN0000N00N1N00NNNNN                      N  07NNNNNNN NN NN NN000001020300000102000000000000000000000000000000000000132500000071500000070000000100000000000100020140221000000025000000N+000000000+000000 +000000000+000000 N00000000 00000002013112720210216                000000000000000000025000000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR5737027S7500000012F737027S7PAM부동산3호                            PAM Real Estate 3                       2016020400001BCN0000N00N1N00NNNNN                      N  03NNNNNNN NN NN NN000005220300000522000000000000000000000000000000000000678000000366000000244000000500000000000500020090424000000027885679N+000000000+000000 +000000000+000000 N00000000 00000002006072020170220                000000000000000000139428395000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR574401722300000013F74401722맵스프런티어브라질1                     MiraeassetMAPSBrazilTrust 1             2016020400005BCN0000N00N1N00NNNNN                      N  03NNNNNNN NN NN NN000000480300000048000000000000000000000000000000000000062400000033600000020000000100000000000100020120511000000080000000N+000000000+000000 +000000000+000000 N00000000 00000002012021720181231                000000000000000000080000000000000N0000700000000000000000000000N0000000000000000000000000000000100000                      KRW410NNNNNYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700002000800000014A000020  동화약품                                DongwhaPharm                            2016020400002STN0000N00N1N00NNNNN000009000032102    03YN    YNNNNNN NN NN NN000009510100000951000000161193900000001545183455000001235000000666000000665000000100000000000000019760324000000027931470N+000000177+005373N+000008225+000116NN00000080N0000008                                000000000000000000027931470000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700003000700000015A000030  우리은행                                Woori Bank                              2016020400005STN0000N00N1N00NNNNN000021022116401    61NY    YYYNNNY NN NN NN000008580100000858000000096828500000000832510939000001115000000601000000686000000500000000001707620141119000000676000000N+000001621+000529N+000026592+000032NN00000500N0000058                                000000000000000003381391855000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        Y0  YY                                                           NN                                                                                                                                                       

A0011KR700004000600000016A000040  KR모터스                                KR MOTORS                               2016020400005STN0000N00N1N00NNNNN000015000033109    03YN    YNNNNNN NN NN NN000001175100000117500000182254600000000215271575000000152500000082500000082000000050000000000000019760525000000175307764N+000000000+000000N+000000385+000305NY00000000N0000000                                000000000000000000087653882000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700005000500000017A000050  경방                                    Kyungbang                               2016020400002STN0000N00N1N00NNNNN000006000031301    82YN    YNNNNNN NN NN NN000203000100020300000000000158100000000031873900000026350000014250000014210000000500000000000000019560303000000002741527N+000004190+004845N+000236250+000086NN00000500N0000002                                000000000000000000013707635000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700006000400000018A000060  메리츠화재                              Meritz Insurance                        2016020400005STN0000N00N1N00NNNNN000021025116501    02NN    YNNNNNN NN NN NN000014800100001480000000010811800000000160339960000001920000001040000001036000000050000000000000019560702000000105963000N+000001131+001309N+000013190+000112NN00000380N0000026                                000000000000000000052981500000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    YNNN000070000000  N N        Y0  NN                                                           NN                                                                                                                                                       

A0011KR700007000300000019A000070  삼양홀딩스                              SAMYANGHOLDINGS                         2016020400003STN0000N00N1N00NNNNN000026000137105    72NN    YNNNNNN NN NN NN000177000100017700000000002857900000000504358400000023000000012400000014160000000500000000000000019681227000000008564271N+000000327+054128N+000148290+000119NN00001500N0000008                                000000000000000000042821355000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700007100100000020A000075  삼양홀딩스우                            SAMYANGHOLDINGS(1P)                     2016020400001STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000077800100007780000000000017700000000001351540000010100000005450000005446000000500000000000000019920221000000000304058N+000000000+000000Y+000000000+000000YN00001550N0000020                                000000000000000000001520290000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700008000200000021A000080  하이트진로                              HITEJINRO                               2016020400004STN0000N00N1N00NNNNN000005000031101    72YN    YNNNNNN NN NN NN000030900100003090000000033727900000001036100460000004015000002165000002472000000500000000004100020091019000000070133611N+000000295+010475N+000018628+000166NN00001000N0000032                                000000000000000000363168055000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  YY                                                           NN                                                                                                                                                       

A0011KR700008200800000022A000087  하이트진로2우B                          HITEJINRO(2PB)                          2016020400004STN0000N00N1N00NNNNN000005000031101    00YN    YNNNNNN NN NN NN000019500100001950000000000148600000000002878700000002535000001365000001365000000500000000000500020110926000000001130138N+000000000+000000Y+000000000+000000YN00001050N0000054                                000000000000000000005650690000000Y0000700007000010000700001002N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700010000800000023A000100  유한양행                                Yuhan                                   2016020400002STN0000N00N1N00NNNNN000009000032102    A1YY    YYNNNYN NN NN NN000330000100033000000000003071000000001012950650000042900000023100000026400000000500000000000000019621101000000011152546N+000008788+003755N+000112029+000295NN00001750N0000005                                000000000000000000055762730000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700010100600000024A000105  유한양행우                              Yuhan(1P)                               2016020400002STN0000N00N1N00NNNNN000009000032102    00YN    YNNNNNN NN NN NN000190000100019000000000000002900000000000548450000024700000013300000013300000000500000000000000019950221000000000236188N+000000000+000000Y+000000000+000000YN00001800N0000009                                000000000000000000001180940000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           YN                                                                                                                                                       

A0011KR700012000600000025A000120  CJ대한통운                              CJ korea express                        2016020400002STN0000N00N1N00NNNNN000019000084903    91NY    YYNNNNN NN NN NN000216000100021600000000002940400000000639205050000028050000015150000017280000000500000000000000019560702000000022812344N+000002510+008606N+000098141+000220NN00000000N0000000                                000000000000000000114061720000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NYNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700014000400000026A000140  하이트진로홀딩스                        HITEJINROHOLDINGS                       2016020400002STN0000N00N1N00NNNNN000026000137105    73NN    YNNNNNN NN NN NN000016000100001600000000004297100000000068691335000002080000001120000001120000000500000000000000019730919000000023206765N+000000000+000000N+000020245+000079NY00000450N0000028                                000000000000000000116033825000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700014100200000027A000145  하이트진로홀딩스우                      HITEJINROHOLDINGS(1P)                   2016020400003STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000011350100001135000000000112700000000001251180000001475000000795000000794000000500000000000000019870929000000000470810N+000000000+000000Y+000000000+000000YN00000500N0000044                                000000000000000000002354050000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700015000300000028A000150  두산                                    DOOSAN                                  2016020400001STN0000N00N1N00NNNNN000026000137105    91NY    YYNNNNN NN NN NN000072400100007240000000011769700000000856784040000009410000005070000005792000000500000000000000019730629000000021270888N+000003129+002314N+000108349+000067NN00004000N0000055                                000000000000000000107854440000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        Y0  YN                                                           NN                                                                                                                                                       

A0011KR700015100100000029A000155  두산우                                  DOOSAN(1P)                              2016020400005STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000051000100005100000000000105300000000005377440000006630000003570000003570000000500000000000000019860731000000004411074N+000000000+000000Y+000000000+000000YN00004050N0000079                                000000000000000000022055370000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700015200900000030A000157  두산2우B                                DOOSAN(2PB)                             2016020400005STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000050500100005050000000000011800000000000590240000006560000003540000003535000000500000000000500019991203000000000985685N+000000000+000000Y+000000000+000000YN00004000N0000079                                000000000000000000004928425000000Y0000700007000010000700001002N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           YN                                                                                                                                                       

A0011KR700018000000000031A000180  성창기업지주                            SCEHoldings                             2016020400004STN0000N00N1N00NNNNN000026000137105    03NN    YNNNNNN NN NN NN000038150100003815000000005117200000000196200200000004955000002675000002670000000500000000000000019760602000000006975160N+000000000+000000N+000042511+000090NY00000000N0000000                                000000000000000000036000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700021000500000032A000210  대림산업                                DaelimInd                               2016020400003STN0000N00N1N00NNNNN000018000064102    11NN    YYNNNNN NN NY NN000077600100007760000000014893400000001157094140000010050000005440000006208000000500000000000000019760202000000034800000N+000000000+000000N+000109537+000071NY00000100N0000001                                000000000000000000197500000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700021100300000033A000215  대림산업우                              DaelimInd(1P)                           2016020400002STN0000N00N1N00NNNNN000018000064102    00NN    YNNNNNN NN NN NN000027500100002750000000000371400000000010180535000003575000001925000001925000000500000000000000019890821000000003800000N+000000000+000000Y+000000000+000000YN00000150N0000005                                000000000000000000021000000000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700022000400000034A000220  유유제약                                YuyuPharma                              2016020400005STN0000N00N1N00NNNNN000009000032102    03YN    YNNNNNN NN NN NN000016000100001600000000075146300000001231978390000002080000001120000001120000000100000000000000019751118000000006161406N+000000000+000000N+000010659+000150NY00000180N0000011                                000000000000000000006538246000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700022100200000035A000225  유유제약1우                             YuyuPharma(1P)                          2016020400001STN0000N00N1N00NNNNN000009000032102    00YN    YNNNNNN NN NN NN000009010100000901000000003350200000000029906641000001170000000631000000630000000100000000000000019900105000000001133465N+000000000+000000Y+000000000+000000YN00000190N0000021                                000000000000000000001133465000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700022200000000036A000227  유유제약2우B                            YuyuPharma(2PB)                         2016020400001STN0000N00N1N00NNNNN000009000032102    00YN    YNNNNNN NN NN NN000020250100002025000000003588400000000072714575000002630000001420000001417000000100000000000500020000620000000000164080N+000000000+000000Y+000000000+000000YN00000190N0000009                                000000000000000000000164080000000Y0000700007000010000700001002N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700023000300000037A000230  일동제약                                IldongPharm                             2016020400004STN0000N00N1N00NNNNN000009000032102    A2YN    YNNNNYN NN NN NN000028200100002820000000014086900000000391962865000003665000001975000002256000000100000000000000019750628000000025068065N+000000489+005767N+000013227+000213NN00000200N0000007                                000000000000000000025068065000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700024000200000038A000240  한국타이어월드와이드                    HANKOOK TIRE WORLDWIDE                  2016020400002STN0000N00N1N00NNNNN000026000137105    81NN    YNNYNNN NN NN NN000017800100001780000000022316200000000394992540000002310000001250000001424000000050000000000000019681227000000093020173N+000002005+000888N+000025963+000069NN00000300N0000017                                000000000000000000046510086500000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        N0  YY                                                           NN                                                                                                                                                       

A0011KR700027000900000039A000270  기아차                                  KiaMtr                                  2016020400002STN0000N00N1N00NNNNN000015000033001    81YY    YYYYNNN NN NN NN000043550100004355000000134254300000005817032350000005660000003050000003484000000500000000000000019730721000000405363347N+000007393+000589N+000055466+000079NN00001000N0000023                                000000000000000002139316735000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        N0  YY                                                           NN                                                                                                                                                       

A0011KR700030000400000040A000300  대유신소재                              SALUM                                   2016020400003STN0000N00N1N00NNNNN000015000033003    03YN    YNNNNNN NN NN NN000001045100000104500000025436000000000026671405000000135500000073500000073000000050000000000000019750609000000088120526N+000000000+000000N+000001113+000094NY00000000N0000000                                000000000000000000044060263000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700032000200000041A000320  노루홀딩스                              NorooHoldings                           2016020400002STN0000N00N1N00NNNNN000026000137105    02NN    YNNNNNN NN NN NN000022750100002275000000000475100000000010734630000002955000001595000001592000000050000000000000019730810000000013198611N+000002283+000996N+000020859+000109NN00000400N0000018                                000000000000000000008361305500000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700032100000000042A000325  노루홀딩스우                            NorooHoldings(1P)                       2016020400003STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000019550100001955000000000015800000000000307240000002540000001370000001173000000050000000000000019890121000000000185250N+000000000+000000Y+000000000+000000YN00000405N0000021                                000000000000000000000092625000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000060000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700032200800000043A000327  노루홀딩스2우B                          NorooHoldings(2PB)                      2016020400002STN0000N00N1N00NNNNN000026000137105    00NN    YNNNNNN NN NN NN000023700100002370000000000155600000000003659050000003080000001660000001659000000050000000000050020070928000000000092540N+000000000+000000Y+000000000+000000YN00000405N0000017                                000000000000000000000046270000000Y0000700007000010000700001002N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700037000700000044A000370  한화손해보험                            Hanwha General Ins                      2016020400005STN0000N00N1N00NNNNN000021025116501    02NN    YNNNNNN NN NN NN000007330100000733000000017370000000000127099748000000952000000514000000513000000500000000000000019750630000000090738915N+000000142+005162N+000006558+000112NN00000000N0000000                                000000000000000000453694575000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    YNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700039000500000045A000390  삼화페인트                              SamhwaPaint                             2016020400003STN0000N00N1N00NNNNN000008000032004    02YN    YNNNNNN NN NN NN000011500100001150000000003411100000000038957660000001495000000805000000805000000050000000000000019930910000000022668570N+000001639+000702N+000012479+000092NN00000400N0000035                                000000000000000000011334285000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700040000200000046A000400  롯데손해보험                            LotteInsurance                          2016020400003STN0000N00N1N00NNNNN000021025116501    03NN    YNNNNNN NN NN NN000002740100000274000000016345100000000044612598000000356000000192000000191000000100000000000000019710416000000134280000N+000000033+008303N+000003876+000071NN00000000N0000000                                000000000000000000134280000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700043000900000047A000430  대원강업                                DaewonKangup                            2016020400005STN0000N00N1N00NNNNN000015000033003    02YN    YNNNNNN NN NN NN000004540100000454000000000516800000000002349783500000590000000318000000317000000050000000000000019770622000000062000000N+000000200+002270N+000006698+000068NN00000120N0000026                                000000000000000000031000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700048000400000048A000480  조선내화                                ChosunRefrctr                           2016020400001STN0000N00N1N00NNNNN000010000032302    32YN    YNNNNNN NN NN NN000080600100008060000000000041200000000003329110000010450000005650000005642000000500000000000000019780630000000004000000N+000012897+000625N+000136969+000059NN00004000N0000050                                000000000000000000020000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700049000300000049A000490  대동공업                                Daedong                                 2016020400001STN0000N00N1N00NNNNN000012000032902    03YN    YNNNNNN NN NN NN000008870100000887000000000678000000000005960953000001150000000621000000620000000100000000000000019750627000000023728210N+000000237+003743N+000009488+000093NN00000060N0000007                                000000000000000000023728210000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700050000900000050A000500  가온전선                                GAONCABLE                               2016020400002STN0000N00N1N00NNNNN000013000032803    03YN    YNNNNNN NN NN NN000018250100001825000000000352500000000006414115000002370000001280000001277000000500000000000000019870608000000004160347N+000000000+000000N+000063147+000029NY00000600N0000033                                000000000000000000020801735000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700052000700000051A000520  삼일제약                                SamilPharm                              2016020400004STN0000N00N1N00NNNNN000009000032102    03YN    YNNNNNN NN NN NN000008530100000853000000001711600000000014514286000001105000000598000000597000000100000000000000019850529000000005500000N+000000000+000000N+000010075+000085NY00000200N0000023                                000000000000000000005500000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700054000500000052A000540  흥국화재                                HeungkukF&MIns                          2016020400001STN0000N00N1N00NNNNN000021025116501    03NN    YNNNNNN NN NN NN000003925100000392500000000104200000000000406367000000510000000275000000274000000500000000000000019741205000000064242645N+000000499+000787N+000006163+000064NN00000000N0000000                                000000000000000000321213225000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700054100300000053A000545  흥국화재우                              HeungkukF&MIns(1P)                      2016020400004STN0000N00N1N00NNNNN000021025116501    00NN    YNNNNNN NN NN NN000004060100000406000000000273800000000001136905000000527000000284500000284000000500000000000000019900320000000000768000N+000000000+000000Y+000000000+000000YN00000000N0000000                                000000000000000000003840000000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700054200100000054A000547  흥국화재2우B                            HeungkukF&MIns(2PB)                     2016020400005STN0000N00N1N00NNNNN000021025116501    00NN    YNNNNNN NN NN NN000015250100001525000000001405600000000022525180000001980000001070000001067000000500000000000500019990809000000000153600N+000000000+000000Y+000000000+000000YN00000000N0000000                                000000000000000000000768000000000Y0000700007000010000700001002N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700059000000000055A000590  CS홀딩스                                CSHOLDINGS                              2016020400004STN0000N00N1N00NNNNN000026000137105    03NN    YNNNNNN NN NN NN000072600100007260000000000168400000000012222340000009430000005090000005082000000500000000000000019751222000000001154482N+000006412+001132N+000165649+000044NN00000000N0000000                                000000000000000000005772410000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700064000300000056A000640  동아쏘시오홀딩스                        Donga Socio Holdings                    2016020400004STN0000N00N1N00NNNNN000026000137105    A2NN    YNNNNYN NN NN NN000214000100021400000000001364300000000289814550000027800000015000000017120000000500000000000000019700210000000004688691N+000000397+053904N+000104036+000206NN00001000N0000005                                000000000000000000023443455000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700065000200000057A000650  천일고속                                ChunilExp                               2016020400003STN0000N00N1N00NNNNN000019000084902    03NN    YNNNNNN NN NN NN000063600100006360000000000082400000000005305610000008260000004460000004452000000500000000000000019770623000000001429220N+000003370+001887N+000032366+000197NN00000000N0000000                                000000000000000000007146100000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700066000100000058A000660  SK하이닉스                              SK hynix                                2016020400005STN0000N00N1N00NNNNN000013000032601    51YY    YYYNYNN NN NN NN000027450100002745000000270526900000007420931365000003565000001925000002196000000500000000000500019961226000000728002365N+000005842+000470N+000024775+000111NN00000300N0000011                                000000000000000003657652050000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  N N        N0  YN                                                           NN                                                                                                                                                       

A0011KR700067000000000059A000670  영풍                                    Youngpoong                              2016020400005STN0000N00N1N00NNNNN000011000032402    31YN    YNNNNNN NY NN NN000931000100093100000000000193000000000179051100000121000000065200000074480000000500000000000000019760612000000001842040N+000074468+001250N+001329356+000070NN00007500N0000008                                000000000000000000009210200000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  N N        N0  NN                                                           YN                                                                                                                                                       

A0011KR700068000900000060A000680  LS네트웍스                              LSNetworks                              2016020400001STN0000N00N1N00NNNNN000016000074608    02NN    YNNNNNN NN NN NN000003195100000319500000002807200000000009040927000000415000000224000000223000000500000000000000019731115000000078798750N+000000007+045643N+000009761+000033NN00000010N0000003                                000000000000000000393993750000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700070000500000061A000700  유수홀딩스                              EUSU HOLDINGS                           2016020400002STN0000N00N1N00NNNNN000026000137105    03NN    YNNNNNN NN NN NN000006950100000695000000015581200000000107697424000000903000000487000000486000000250000000000000019560303000000026041812N+000000000+000000N+000007336+000095NY00000000N0000000                                000000000000000000065104530000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700072000300000062A000720  현대건설                                HyundaiEng&Const                        2016020400005STN0000N00N1N00NNNNN000018000064102    11NY    YYYNNNN NN NY NN000036000100003600000000093539500000003366552525000004680000002520000002880000000500000000000000019841222000000111355765N+000003768+000955N+000048844+000074NN00000500N0000014                                000000000000000000556778825000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    NNNN000080000000  Y N        N0  YN                                                           NN                                                                                                                                                       

A0011KR700072100100000063A000725  현대건설우                              HyundaiEng&Con(1P)                      2016020400004STN0000N00N1N00NNNNN000018000064102    00NN    YNNNNNN NN NN NN000043150100004315000000000056400000000002464855000005600000003025000003020000000500000000000000019890921000000000098856N+000000000+000000Y+000000000+000000YN00000550N0000013                                000000000000000000000494280000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           YN                                                                                                                                                       

A0011KR700076000900000064A000760  이화산업                                RIFA                                    2016020400003STN0000N00N1N00NNNNN000016000074607    03NN    YNNNNNN NN NN NN000019850100001985000000001624500000000032831585000002580000001390000001389000000500000000000000019940429000000002800000N+000002560+000775N+000039123+000051NN00000000N0000000                                000000000000000000014000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700081000200000065A000810  삼성화재                                SamsungF&MIns                           2016020400002STN0000N00N1N00NNNNN000021025116501    61NY    YYYNNNN NN NN NN000303500100030350000000003806400000001150091782000039450000021250000024280000000050000000000000019750630000000047374837N+000018786+001616N+000188371+000161NN00004500N0000015                                000000000000000000024802418500000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 Y    YNNN000080000000  Y N        Y0  YN                                                           NN                                                                                                                                                       

A0011KR700081100000000066A000815  삼성화재우                              SamsungF&MIns(1P)                       2016020400002STN0000N00N1N00NNNNN000021025116501    00NN    YNNNNNN NN NN NN000195000100019500000000000317500000000061379500000025350000013650000013650000000050000000000000019900410000000003192000N+000000000+000000Y+000000000+000000YN00004505N0000023                                000000000000000000001671000000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700085000800000067A000850  화천기공                                HMT                                     2016020400004STN0000N00N1N00NNNNN000012000032902    03YN    YNNNNNN NN NN NN000050800100005080000000000155800000000007992940000006600000003560000003556000000500000000001300019991118000000002200000N+000009700+000524N+000113144+000045NN00001500N0000030                                000000000000000000011000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700086000700000068A000860  강남제비스코                            KANGNAM JEVISCO                         2016020400001STN0000N00N1N00NNNNN000008000032004    02YN    YNNNNNN NN NN NN000035500100003550000000001210900000000042793295000004615000002485000002485000000100000000000000019751112000000006500000N+000005928+000599N+000061484+000058NN00000500N0000014                                000000000000000000006500000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700088000500000069A000880  한화                                    Hanwha                                  2016020400005STN0000N00N1N00NNNNN000008000032004    41YN    YYNNNNN YN NN NN000035550100003555000000025011200000000884123915000004620000002490000002844000000500000000000000019760624000000074958735N+000000000+000000N+000057774+000062NY00000500N0000014                                000000000000000000374793675000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000080000000  Y N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700088100300000070A000885  한화우                                  Hanwha(1P)                              2016020400003STN0000N00N1N00NNNNN000008000032004    00YN    YNNNNNN NN NN NN000020950100002095000000000134500000000002792740000002720000001470000001466000000500000000000000019900122000000000479294N+000000000+000000Y+000000000+000000YN00000550N0000026                                000000000000000000002396470000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700089000400000071A000890  보해양조                                BohaeBrew                               2016020400003STN0000N00N1N00NNNNN000005000031101    03YN    YNNNNNN NN NN NN000002030100000203000000192843000000000388635337500000263500000142500000142000000050000000000000019880923000000095796397N+000000074+002743N+000000965+000210NN00000000N0000000                                000000000000000000047898198500000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700091000000000072A000910  유니온                                  Union                                   2016020400001STN0000N00N1N00NNNNN000010000032303    03YN    YNNNNNN NN NN NN000003780100000378000000001755700000000006597468500000491000000265000000264000000050000000000500019960703000000015611619N+000000254+001488N+000008351+000045NN00000070N0000019                                000000000000000000007805809500000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700095000600000073A000950  전방                                    Chonbang                                2016020400002STN0000N00N1N00NNNNN000006000031301    03YN    YNNNNNN NN NN NN000053000100005300000000000135200000000007213720000006890000003710000003710000000500000000000000019681021000000001680000N+000000000+000000N+000102101+000052NY00000000N0000000                                000000000000000000008400000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700097000400000074A000970  한국주철관                              KorCastIronPipe                         2016020400001STN0000N00N1N00NNNNN000011000032401    03YN    YNNNNNN NN NN NN000011100100001110000000005530900000000060201720000001440000000780000000777000000050000000000000019691212000000022800500N+000000351+003162N+000010228+000109NN00000125N0000011                                000000000000000000012000000000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700099000200000075A000990  동부하이텍                              Dongbu HiTek                            2016020400003STN0000N00N1N00NNNNN000013000032601    03YN    YNNNNNN NN NN NN000013800100001380000000033239500000000453082040000001790000000970000000966000000500000000000000019751212000000044367832N+000000000+000000N+000002712+000509NY00000000N0000000                                000000000000000000221839160000000Y0000700007000010000700001000N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

A0011KR700099100000000076A000995  동부하이텍1우                           Dongbu HiTek(1P)                        2016020400004STN0000N00N1N00NNNNN000013000032601    00YN    YNNNNNN NN NN NN000034350100003435000000000049900000000001829240000004465000002405000002404000000500000000000500020070521000000000112316N+000000000+000000Y+000000000+000000YN00000000N0000000                                000000000000000000000561580000000Y0000700007000010000700001001N0000000000000000000000000000000100001                      KRW410NYYYYYY   +00000000000 N    NNNN000070000000  N N        N0  NN                                                           NN                                                                                                                                                       

*/

 

void insert_into_st_basic_ex_trade(struct st_basic_ex_trade *st_basic_ex_trade_tmp, struct st_basic_trade st_basic_trade_tmp)

{

#if(0)

if((int)sizeof(st_basic_trade_tmp.dataclass)==1) st_basic_ex_trade_tmp->dataclass[0]= st_basic_trade_tmp.dataclass;

if((int)sizeof(st_basic_trade_tmp.infoclass)==1) st_basic_ex_trade_tmp->infoclass[0]= st_basic_trade_tmp.infoclass;

if((int)sizeof(st_basic_trade_tmp.marketclass)==1) st_basic_ex_trade_tmp->marketclass[0]= st_basic_trade_tmp.marketclass;

if((int)sizeof(st_basic_trade_tmp.stockcode)==1) st_basic_ex_trade_tmp->stockcode[0]= st_basic_trade_tmp.stockcode;

if((int)sizeof(st_basic_trade_tmp.serialno)==1) st_basic_ex_trade_tmp->serialno[0]= st_basic_trade_tmp.serialno;

if((int)sizeof(st_basic_trade_tmp.abbrstockcode)==1) st_basic_ex_trade_tmp->abbrstockcode[0]= st_basic_trade_tmp.abbrstockcode;

if((int)sizeof(st_basic_trade_tmp.abbrstocknamekor)==1) st_basic_ex_trade_tmp->abbrstocknamekor[0]= st_basic_trade_tmp.abbrstocknamekor;

if((int)sizeof(st_basic_trade_tmp.abbrstocknameeng)==1) st_basic_ex_trade_tmp->abbrstocknameeng[0]= st_basic_trade_tmp.abbrstocknameeng;

if((int)sizeof(st_basic_trade_tmp.senddate)==1) st_basic_ex_trade_tmp->senddate[0]= st_basic_trade_tmp.senddate;

if((int)sizeof(st_basic_trade_tmp.infodivisiongroupno)==1) st_basic_ex_trade_tmp->infodivisiongroupno[0]= st_basic_trade_tmp.infodivisiongroupno;

if((int)sizeof(st_basic_trade_tmp.stockgroupid)==1) st_basic_ex_trade_tmp->stockgroupid[0]= st_basic_trade_tmp.stockgroupid;

if((int)sizeof(st_basic_trade_tmp.isunittrade)==1) st_basic_ex_trade_tmp->isunittrade[0]= st_basic_trade_tmp.isunittrade;

if((int)sizeof(st_basic_trade_tmp.exclasscode)==1) st_basic_ex_trade_tmp->exclasscode[0]= st_basic_trade_tmp.exclasscode;

if((int)sizeof(st_basic_trade_tmp.facevaluechangeclasscode)==1) st_basic_ex_trade_tmp->facevaluechangeclasscode[0]= st_basic_trade_tmp.facevaluechangeclasscode;

if((int)sizeof(st_basic_trade_tmp.isopenpricebasedstandardprice;)==1) st_basic_ex_trade_tmp->isopenpricebasedstandardprice;[0]= st_basic_trade_tmp.isopenpricebasedstandardprice;;

if((int)sizeof(st_basic_trade_tmp.isrevaluationstockreason)==1) st_basic_ex_trade_tmp->isrevaluationstockreason[0]= st_basic_trade_tmp.isrevaluationstockreason;

if((int)sizeof(st_basic_trade_tmp.isstandardpricechangestock)==1) st_basic_ex_trade_tmp->isstandardpricechangestock[0]= st_basic_trade_tmp.isstandardpricechangestock;

if((int)sizeof(st_basic_trade_tmp.israndomendpossibillty)==1) st_basic_ex_trade_tmp->israndomendpossibillty[0]= st_basic_trade_tmp.israndomendpossibillty;

if((int)sizeof(st_basic_trade_tmp.ismarketalarmdangernotice)==1) st_basic_ex_trade_tmp->ismarketalarmdangernotice[0]= st_basic_trade_tmp.ismarketalarmdangernotice;

if((int)sizeof(st_basic_trade_tmp.marketalarmclasscode)==1) st_basic_ex_trade_tmp->marketalarmclasscode[0]= st_basic_trade_tmp.marketalarmclasscode;

if((int)sizeof(st_basic_trade_tmp.iscorporategovernancefine;)==1) st_basic_ex_trade_tmp->iscorporategovernancefine;[0]= st_basic_trade_tmp.iscorporategovernancefine;;

if((int)sizeof(st_basic_trade_tmp.ismanagementstock)==1) st_basic_ex_trade_tmp->ismanagementstock[0]= st_basic_trade_tmp.ismanagementstock;

if((int)sizeof(st_basic_trade_tmp.isinsinceritypublicnewsappoint)==1) st_basic_ex_trade_tmp->isinsinceritypublicnewsappoint[0]= st_basic_trade_tmp.isinsinceritypublicnewsappoint;

if((int)sizeof(st_basic_trade_tmp.isbackdoorlisting)==1) st_basic_ex_trade_tmp->isbackdoorlisting[0]= st_basic_trade_tmp.isbackdoorlisting;

if((int)sizeof(st_basic_trade_tmp.istradestop)==1) st_basic_ex_trade_tmp->istradestop[0]= st_basic_trade_tmp.istradestop;

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypelarge)==1) st_basic_ex_trade_tmp->indexbusinesstypelarge[0]= st_basic_trade_tmp.indexbusinesstypelarge;

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypemedium)==1) st_basic_ex_trade_tmp->indexbusinesstypemedium[0]= st_basic_trade_tmp.indexbusinesstypemedium;

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypesmall)==1) st_basic_ex_trade_tmp->indexbusinesstypesmall[0]= st_basic_trade_tmp.indexbusinesstypesmall;

if((int)sizeof(st_basic_trade_tmp.standardindustrycode)==1) st_basic_ex_trade_tmp->standardindustrycode[0]= st_basic_trade_tmp.standardindustrycode;

if((int)sizeof(st_basic_trade_tmp.businesstypekospi200)==1) st_basic_ex_trade_tmp->businesstypekospi200[0]= st_basic_trade_tmp.businesstypekospi200;

if((int)sizeof(st_basic_trade_tmp.listpricesizecode)==1) st_basic_ex_trade_tmp->listpricesizecode[0]= st_basic_trade_tmp.listpricesizecode;

if((int)sizeof(st_basic_trade_tmp.ismanufactureindustry)==1) st_basic_ex_trade_tmp->ismanufactureindustry[0]= st_basic_trade_tmp.ismanufactureindustry;

if((int)sizeof(st_basic_trade_tmp.iskrx100stock)==1) st_basic_ex_trade_tmp->iskrx100stock[0]= st_basic_trade_tmp.iskrx100stock;

if((int)sizeof(st_basic_trade_tmp.isdividendindexstock)==1) st_basic_ex_trade_tmp->isdividendindexstock[0]= st_basic_trade_tmp.isdividendindexstock;

if((int)sizeof(st_basic_trade_tmp.iscorporategovernanceindexstock)==1) st_basic_ex_trade_tmp->iscorporategovernanceindexstock[0]= st_basic_trade_tmp.iscorporategovernanceindexstock;

if((int)sizeof(st_basic_trade_tmp.investorganclasscode)==1) st_basic_ex_trade_tmp->investorganclasscode[0]= st_basic_trade_tmp.investorganclasscode;

if((int)sizeof(st_basic_trade_tmp.iskospi)==1) st_basic_ex_trade_tmp->iskospi[0]= st_basic_trade_tmp.iskospi;

if((int)sizeof(st_basic_trade_tmp.iskospi100)==1) st_basic_ex_trade_tmp->iskospi100[0]= st_basic_trade_tmp.iskospi100;

if((int)sizeof(st_basic_trade_tmp.iskospi50)==1) st_basic_ex_trade_tmp->iskospi50[0]= st_basic_trade_tmp.iskospi50;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexcar)==1) st_basic_ex_trade_tmp->iskrxsectorindexcar[0]= st_basic_trade_tmp.iskrxsectorindexcar;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexsemiconductor)==1) st_basic_ex_trade_tmp->iskrxsectorindexsemiconductor[0]= st_basic_trade_tmp.iskrxsectorindexsemiconductor;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexbio)==1) st_basic_ex_trade_tmp->iskrxsectorindexbio[0]= st_basic_trade_tmp.iskrxsectorindexbio;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinance)==1) st_basic_ex_trade_tmp->iskrxsectorindexfinance[0]= st_basic_trade_tmp.iskrxsectorindexfinance;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexit)==1) st_basic_ex_trade_tmp->iskrxsectorindexit[0]= st_basic_trade_tmp.iskrxsectorindexit;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexenergychemical)==1) st_basic_ex_trade_tmp->iskrxsectorindexenergychemical[0]= st_basic_trade_tmp.iskrxsectorindexenergychemical;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexsteel)==1) st_basic_ex_trade_tmp->iskrxsectorindexsteel[0]= st_basic_trade_tmp.iskrxsectorindexsteel;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexnecessary)==1) st_basic_ex_trade_tmp->iskrxsectorindexnecessary[0]= st_basic_trade_tmp.iskrxsectorindexnecessary;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexmediacomm)==1) st_basic_ex_trade_tmp->iskrxsectorindexmediacomm[0]= st_basic_trade_tmp.iskrxsectorindexmediacomm;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexconstruction)==1) st_basic_ex_trade_tmp->iskrxsectorindexconstruction[0]= st_basic_trade_tmp.iskrxsectorindexconstruction;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinanceservice)==1) st_basic_ex_trade_tmp->iskrxsectorindexfinanceservice[0]= st_basic_trade_tmp.iskrxsectorindexfinanceservice;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexstock)==1) st_basic_ex_trade_tmp->iskrxsectorindexstock[0]= st_basic_trade_tmp.iskrxsectorindexstock;

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexship)==1) st_basic_ex_trade_tmp->iskrxsectorindexship[0]= st_basic_trade_tmp.iskrxsectorindexship;

if((int)sizeof(st_basic_trade_tmp.standardprice)==1) st_basic_ex_trade_tmp->standardprice[0]= st_basic_trade_tmp.standardprice;

if((int)sizeof(st_basic_trade_tmp.ydayclosepriceclasscode)==1) st_basic_ex_trade_tmp->ydayclosepriceclasscode[0]= st_basic_trade_tmp.ydayclosepriceclasscode;

if((int)sizeof(st_basic_trade_tmp.ydaycloseprice)==1) st_basic_ex_trade_tmp->ydaycloseprice[0]= st_basic_trade_tmp.ydaycloseprice;

if((int)sizeof(st_basic_trade_tmp.ydayaccmvolume)==1) st_basic_ex_trade_tmp->ydayaccmvolume[0]= st_basic_trade_tmp.ydayaccmvolume;

if((int)sizeof(st_basic_trade_tmp.ydayaccmamount)==1) st_basic_ex_trade_tmp->ydayaccmamount[0]= st_basic_trade_tmp.ydayaccmamount;

if((int)sizeof(st_basic_trade_tmp.uplimitprice)==1) st_basic_ex_trade_tmp->uplimitprice[0]= st_basic_trade_tmp.uplimitprice;

if((int)sizeof(st_basic_trade_tmp.downlimitprice)==1) st_basic_ex_trade_tmp->downlimitprice[0]= st_basic_trade_tmp.downlimitprice;

if((int)sizeof(st_basic_trade_tmp.substituteprice)==1) st_basic_ex_trade_tmp->substituteprice[0]= st_basic_trade_tmp.substituteprice;

if((int)sizeof(st_basic_trade_tmp.facevalue)==1) st_basic_ex_trade_tmp->facevalue[0]= st_basic_trade_tmp.facevalue;

#endif

 

#if(1)

if((int)sizeof(st_basic_trade_tmp.dataclass)>= 1) memcpy(st_basic_ex_trade_tmp->dataclass,st_basic_trade_tmp.dataclass,(int)sizeof(st_basic_trade_tmp.dataclass));

if((int)sizeof(st_basic_trade_tmp.infoclass)>= 1) memcpy(st_basic_ex_trade_tmp->infoclass,st_basic_trade_tmp.infoclass,(int)sizeof(st_basic_trade_tmp.infoclass));

if((int)sizeof(st_basic_trade_tmp.marketclass)>= 1) memcpy(st_basic_ex_trade_tmp->marketclass,st_basic_trade_tmp.marketclass,(int)sizeof(st_basic_trade_tmp.marketclass));

if((int)sizeof(st_basic_trade_tmp.stockcode)>= 1) memcpy(st_basic_ex_trade_tmp->stockcode,st_basic_trade_tmp.stockcode,(int)sizeof(st_basic_trade_tmp.stockcode));

if((int)sizeof(st_basic_trade_tmp.serialno)>= 1) memcpy(st_basic_ex_trade_tmp->serialno,st_basic_trade_tmp.serialno,(int)sizeof(st_basic_trade_tmp.serialno));

if((int)sizeof(st_basic_trade_tmp.abbrstockcode)>= 1) memcpy(st_basic_ex_trade_tmp->abbrstockcode,st_basic_trade_tmp.abbrstockcode,(int)sizeof(st_basic_trade_tmp.abbrstockcode));

if((int)sizeof(st_basic_trade_tmp.abbrstocknamekor)>= 1) memcpy(st_basic_ex_trade_tmp->abbrstocknamekor,st_basic_trade_tmp.abbrstocknamekor,(int)sizeof(st_basic_trade_tmp.abbrstocknamekor));

if((int)sizeof(st_basic_trade_tmp.abbrstocknameeng)>= 1) memcpy(st_basic_ex_trade_tmp->abbrstocknameeng,st_basic_trade_tmp.abbrstocknameeng,(int)sizeof(st_basic_trade_tmp.abbrstocknameeng));

if((int)sizeof(st_basic_trade_tmp.senddate)>= 1) memcpy(st_basic_ex_trade_tmp->senddate,st_basic_trade_tmp.senddate,(int)sizeof(st_basic_trade_tmp.senddate));

if((int)sizeof(st_basic_trade_tmp.infodivisiongroupno)>= 1) memcpy(st_basic_ex_trade_tmp->infodivisiongroupno,st_basic_trade_tmp.infodivisiongroupno,(int)sizeof(st_basic_trade_tmp.infodivisiongroupno));

if((int)sizeof(st_basic_trade_tmp.stockgroupid)>= 1) memcpy(st_basic_ex_trade_tmp->stockgroupid,st_basic_trade_tmp.stockgroupid,(int)sizeof(st_basic_trade_tmp.stockgroupid));

if((int)sizeof(st_basic_trade_tmp.isunittrade)>= 1) memcpy(st_basic_ex_trade_tmp->isunittrade,st_basic_trade_tmp.isunittrade,(int)sizeof(st_basic_trade_tmp.isunittrade));

if((int)sizeof(st_basic_trade_tmp.exclasscode)>= 1) memcpy(st_basic_ex_trade_tmp->exclasscode,st_basic_trade_tmp.exclasscode,(int)sizeof(st_basic_trade_tmp.exclasscode));

if((int)sizeof(st_basic_trade_tmp.facevaluechangeclasscode)>= 1) memcpy(st_basic_ex_trade_tmp->facevaluechangeclasscode,st_basic_trade_tmp.facevaluechangeclasscode,(int)sizeof(st_basic_trade_tmp.facevaluechangeclasscode));

if((int)sizeof(st_basic_trade_tmp.isopenpricebasedstandardprice)>= 1) memcpy(st_basic_ex_trade_tmp->isopenpricebasedstandardprice,st_basic_trade_tmp.isopenpricebasedstandardprice,(int)sizeof(st_basic_trade_tmp.isopenpricebasedstandardprice));

if((int)sizeof(st_basic_trade_tmp.isrevaluationstockreason)>= 1) memcpy(st_basic_ex_trade_tmp->isrevaluationstockreason,st_basic_trade_tmp.isrevaluationstockreason,(int)sizeof(st_basic_trade_tmp.isrevaluationstockreason));

if((int)sizeof(st_basic_trade_tmp.isstandardpricechangestock)>= 1) memcpy(st_basic_ex_trade_tmp->isstandardpricechangestock,st_basic_trade_tmp.isstandardpricechangestock,(int)sizeof(st_basic_trade_tmp.isstandardpricechangestock));

if((int)sizeof(st_basic_trade_tmp.israndomendpossibillty)>= 1) memcpy(st_basic_ex_trade_tmp->israndomendpossibillty,st_basic_trade_tmp.israndomendpossibillty,(int)sizeof(st_basic_trade_tmp.israndomendpossibillty));

if((int)sizeof(st_basic_trade_tmp.ismarketalarmdangernotice)>= 1) memcpy(st_basic_ex_trade_tmp->ismarketalarmdangernotice,st_basic_trade_tmp.ismarketalarmdangernotice,(int)sizeof(st_basic_trade_tmp.ismarketalarmdangernotice));

if((int)sizeof(st_basic_trade_tmp.marketalarmclasscode)>= 1) memcpy(st_basic_ex_trade_tmp->marketalarmclasscode,st_basic_trade_tmp.marketalarmclasscode,(int)sizeof(st_basic_trade_tmp.marketalarmclasscode));

if((int)sizeof(st_basic_trade_tmp.iscorporategovernancefine)>= 1) memcpy(st_basic_ex_trade_tmp->iscorporategovernancefine,st_basic_trade_tmp.iscorporategovernancefine,(int)sizeof(st_basic_trade_tmp.iscorporategovernancefine));

if((int)sizeof(st_basic_trade_tmp.ismanagementstock)>= 1) memcpy(st_basic_ex_trade_tmp->ismanagementstock,st_basic_trade_tmp.ismanagementstock,(int)sizeof(st_basic_trade_tmp.ismanagementstock));

if((int)sizeof(st_basic_trade_tmp.isinsinceritypublicnewsappoint)>= 1) memcpy(st_basic_ex_trade_tmp->isinsinceritypublicnewsappoint,st_basic_trade_tmp.isinsinceritypublicnewsappoint,(int)sizeof(st_basic_trade_tmp.isinsinceritypublicnewsappoint));

if((int)sizeof(st_basic_trade_tmp.isbackdoorlisting)>= 1) memcpy(st_basic_ex_trade_tmp->isbackdoorlisting,st_basic_trade_tmp.isbackdoorlisting,(int)sizeof(st_basic_trade_tmp.isbackdoorlisting));

if((int)sizeof(st_basic_trade_tmp.istradestop)>= 1) memcpy(st_basic_ex_trade_tmp->istradestop,st_basic_trade_tmp.istradestop,(int)sizeof(st_basic_trade_tmp.istradestop));

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypelarge)>= 1) memcpy(st_basic_ex_trade_tmp->indexbusinesstypelarge,st_basic_trade_tmp.indexbusinesstypelarge,(int)sizeof(st_basic_trade_tmp.indexbusinesstypelarge));

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypemedium)>= 1) memcpy(st_basic_ex_trade_tmp->indexbusinesstypemedium,st_basic_trade_tmp.indexbusinesstypemedium,(int)sizeof(st_basic_trade_tmp.indexbusinesstypemedium));

if((int)sizeof(st_basic_trade_tmp.indexbusinesstypesmall)>= 1) memcpy(st_basic_ex_trade_tmp->indexbusinesstypesmall,st_basic_trade_tmp.indexbusinesstypesmall,(int)sizeof(st_basic_trade_tmp.indexbusinesstypesmall));

if((int)sizeof(st_basic_trade_tmp.standardindustrycode)>= 1) memcpy(st_basic_ex_trade_tmp->standardindustrycode,st_basic_trade_tmp.standardindustrycode,(int)sizeof(st_basic_trade_tmp.standardindustrycode));

if((int)sizeof(st_basic_trade_tmp.businesstypekospi200)>= 1) memcpy(st_basic_ex_trade_tmp->businesstypekospi200,st_basic_trade_tmp.businesstypekospi200,(int)sizeof(st_basic_trade_tmp.businesstypekospi200));

if((int)sizeof(st_basic_trade_tmp.listpricesizecode)>= 1) memcpy(st_basic_ex_trade_tmp->listpricesizecode,st_basic_trade_tmp.listpricesizecode,(int)sizeof(st_basic_trade_tmp.listpricesizecode));

if((int)sizeof(st_basic_trade_tmp.ismanufactureindustry)>= 1) memcpy(st_basic_ex_trade_tmp->ismanufactureindustry,st_basic_trade_tmp.ismanufactureindustry,(int)sizeof(st_basic_trade_tmp.ismanufactureindustry));

if((int)sizeof(st_basic_trade_tmp.iskrx100stock)>= 1) memcpy(st_basic_ex_trade_tmp->iskrx100stock,st_basic_trade_tmp.iskrx100stock,(int)sizeof(st_basic_trade_tmp.iskrx100stock));

if((int)sizeof(st_basic_trade_tmp.isdividendindexstock)>= 1) memcpy(st_basic_ex_trade_tmp->isdividendindexstock,st_basic_trade_tmp.isdividendindexstock,(int)sizeof(st_basic_trade_tmp.isdividendindexstock));

if((int)sizeof(st_basic_trade_tmp.iscorporategovernanceindexstock)>= 1) memcpy(st_basic_ex_trade_tmp->iscorporategovernanceindexstock,st_basic_trade_tmp.iscorporategovernanceindexstock,(int)sizeof(st_basic_trade_tmp.iscorporategovernanceindexstock));

if((int)sizeof(st_basic_trade_tmp.investorganclasscode)>= 1) memcpy(st_basic_ex_trade_tmp->investorganclasscode,st_basic_trade_tmp.investorganclasscode,(int)sizeof(st_basic_trade_tmp.investorganclasscode));

if((int)sizeof(st_basic_trade_tmp.iskospi)>= 1) memcpy(st_basic_ex_trade_tmp->iskospi,st_basic_trade_tmp.iskospi,(int)sizeof(st_basic_trade_tmp.iskospi));

if((int)sizeof(st_basic_trade_tmp.iskospi100)>= 1) memcpy(st_basic_ex_trade_tmp->iskospi100,st_basic_trade_tmp.iskospi100,(int)sizeof(st_basic_trade_tmp.iskospi100));

if((int)sizeof(st_basic_trade_tmp.iskospi50)>= 1) memcpy(st_basic_ex_trade_tmp->iskospi50,st_basic_trade_tmp.iskospi50,(int)sizeof(st_basic_trade_tmp.iskospi50));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexcar)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexcar,st_basic_trade_tmp.iskrxsectorindexcar,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexcar));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexsemiconductor)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexsemiconductor,st_basic_trade_tmp.iskrxsectorindexsemiconductor,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexsemiconductor));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexbio)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexbio,st_basic_trade_tmp.iskrxsectorindexbio,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexbio));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinance)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexfinance,st_basic_trade_tmp.iskrxsectorindexfinance,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinance));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexit)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexit,st_basic_trade_tmp.iskrxsectorindexit,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexit));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexenergychemical)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexenergychemical,st_basic_trade_tmp.iskrxsectorindexenergychemical,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexenergychemical));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexsteel)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexsteel,st_basic_trade_tmp.iskrxsectorindexsteel,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexsteel));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexnecessary)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexnecessary,st_basic_trade_tmp.iskrxsectorindexnecessary,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexnecessary));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexmediacomm)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexmediacomm,st_basic_trade_tmp.iskrxsectorindexmediacomm,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexmediacomm));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexconstruction)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexconstruction,st_basic_trade_tmp.iskrxsectorindexconstruction,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexconstruction));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinanceservice)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexfinanceservice,st_basic_trade_tmp.iskrxsectorindexfinanceservice,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexfinanceservice));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexstock)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexstock,st_basic_trade_tmp.iskrxsectorindexstock,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexstock));

if((int)sizeof(st_basic_trade_tmp.iskrxsectorindexship)>= 1) memcpy(st_basic_ex_trade_tmp->iskrxsectorindexship,st_basic_trade_tmp.iskrxsectorindexship,(int)sizeof(st_basic_trade_tmp.iskrxsectorindexship));

if((int)sizeof(st_basic_trade_tmp.standardprice)>= 1) memcpy(st_basic_ex_trade_tmp->standardprice,st_basic_trade_tmp.standardprice,(int)sizeof(st_basic_trade_tmp.standardprice));

if((int)sizeof(st_basic_trade_tmp.ydayclosepriceclasscode)>= 1) memcpy(st_basic_ex_trade_tmp->ydayclosepriceclasscode,st_basic_trade_tmp.ydayclosepriceclasscode,(int)sizeof(st_basic_trade_tmp.ydayclosepriceclasscode));

if((int)sizeof(st_basic_trade_tmp.ydaycloseprice)>= 1) memcpy(st_basic_ex_trade_tmp->ydaycloseprice,st_basic_trade_tmp.ydaycloseprice,(int)sizeof(st_basic_trade_tmp.ydaycloseprice));

if((int)sizeof(st_basic_trade_tmp.ydayaccmvolume)>= 1) memcpy(st_basic_ex_trade_tmp->ydayaccmvolume,st_basic_trade_tmp.ydayaccmvolume,(int)sizeof(st_basic_trade_tmp.ydayaccmvolume));

if((int)sizeof(st_basic_trade_tmp.ydayaccmamount)>= 1) memcpy(st_basic_ex_trade_tmp->ydayaccmamount,st_basic_trade_tmp.ydayaccmamount,(int)sizeof(st_basic_trade_tmp.ydayaccmamount));

if((int)sizeof(st_basic_trade_tmp.uplimitprice)>= 1) memcpy(st_basic_ex_trade_tmp->uplimitprice,st_basic_trade_tmp.uplimitprice,(int)sizeof(st_basic_trade_tmp.uplimitprice));

if((int)sizeof(st_basic_trade_tmp.downlimitprice)>= 1) memcpy(st_basic_ex_trade_tmp->downlimitprice,st_basic_trade_tmp.downlimitprice,(int)sizeof(st_basic_trade_tmp.downlimitprice));

if((int)sizeof(st_basic_trade_tmp.substituteprice)>= 1) memcpy(st_basic_ex_trade_tmp->substituteprice,st_basic_trade_tmp.substituteprice,(int)sizeof(st_basic_trade_tmp.substituteprice));

if((int)sizeof(st_basic_trade_tmp.facevalue)>= 1) memcpy(st_basic_ex_trade_tmp->facevalue,st_basic_trade_tmp.facevalue,(int)sizeof(st_basic_trade_tmp.facevalue));

#endif

}

 

 

/*

카카오 신입공채 1차 코딩테스트 문제1 비밀지도

 

문제설명

네오는 평소 프로도가 비상금을 숨겨놓는 장소를 알려줄 비밀지도를 손에 넣었다. 그런데 이 비밀지도는 숫자로 암호화되어 있어 위치를 확인하기 위해서는 암호를 해독해야 한다. 다행히 지도 암호를 해독할 방법을 적어놓은 메모도 함께 발견했다.

 

지도는 한 변의 길이가 n인 정사각형 배열 형태로, 각 칸은 “공백”(“ “) 또는 “벽”(“#”) 두 종류로 이루어져 있다.

전체 지도는 두 장의 지도를 겹쳐서 얻을 수 있다. 각각 “지도 1”과 “지도 2”라고 하자. 지도 1 또는 지도 2 중 어느 하나라도 벽인 부분은 전체 지도에서도 벽이다. 지도 1과 지도 2에서 모두 공백인 부분은 전체 지도에서도 공백이다.

“지도 1”과 “지도 2”는 각각 정수 배열로 암호화되어 있다.

암호화된 배열은 지도의 각 가로줄에서 벽 부분을 1, 공백 부분을 0으로 부호화했을 때 얻어지는 이진수에 해당하는 값의 배열이다.

 

이해이미지)

[0001]:# ###

[0002]:#    #

[0003]:#    #

[0004]: # ##

[0005]: #####

[0006]:##  #

[0001]: ## ##

[0002]:###

[0003]: #  ##

[0004]:  ###

[0005]:  ###

[0006]:  # #

[0001]:######

[0002]:###  #

[0003]:##  ##

[0004]: ####

[0005]: #####

[0006]:### #

 

 

 

[0001]:[# ### ][ ## ##][######]

[0002]:[#    #][###   ][###  #]

[0003]:[#    #][ #  ##][##  ##]

[0004]:[ # ## ][  ### ][ #### ]

[0005]:[ #####][  ### ][ #####]

[0006]:[##  # ][  # # ][### # ]

 

네오가 프로도의 비상금을 손에 넣을 수 있도록, 비밀지도의 암호를 해독하는 작업을 도와줄 프로그램을 작성하라.

 

입력형식

입력으로 지도의 한 변 크기 n 과 2개의 정수 배열 arr1, arr2가 들어온다.

arr1, arr2는 길이 n인 정수 배열로 주어진다.

정수 배열의 각 원소 x를 이진수로 변환했을 때의 길이는 n 이하이다. 즉, 0 ? x ? 2^n - 1을 만족한다.

 

출력형식

원래의 비밀지도를 해독하여 "#", 공백으로 구성된 문자열 배열로 출력하라.

 

문제해설

이 문제는 비트 연산Bitwise Operation을 묻는 문제입니다. 이미 문제 예시에 2진수로 처리하는 힌트가 포함되어 있고, 둘 중 하나가 1일 경우에 벽 #이 생기기 때문에 OR로 처리하면 간단히 풀 수 있습니다. 아주 쉬운 문제였던 만큼 if else로 풀이한 분들도 많이 발견되었는데요. 정답으로는 간주되지만 이 문제는 비트 연산을 잘 다룰 수 있는지를 묻고자 하는 의도였던 만큼 앞으로 이런 유형의 문제를 풀 때는 비트 연산을 꼭 기억하시기 바랍니다.

 

이 문제의 정답률은 81.78%입니다. 첫 번째 문제이고 가장 쉬운 문제였던 만큼 많은 분들이 잘 풀어주셨습니다.

*/

 

 

#include <stdio.h>

#include <string.h>

 

void ____set_decoration(int NN, char resultstr[6][100], int width[6], char idx)

{

int ii, height;

 

height=0;

for(ii=0; ii<NN; ii++)

{

resultstr[height][width[ii]] = idx;

width[ii]++;

height++;

}

}

 

int main(int argc, char *argv[])

{

    int NN=6;

int arr1[6] = {46, 33, 33 ,22, 31, 50};

    int arr2[6] = {27 ,56, 19, 14, 14, 10};

    int hexadecimal[16] = {0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,

0x0100,0x0200,0x0400,0x0800,0x1000,0x2000,0x4000,0x8000};

int ii,kk;

int width[6];

int height=0;

char resultstr[6][100];

 

memset(resultstr,0x00,sizeof(resultstr));

memset(width,0x00,sizeof(width));

 

#if(1)

____set_decoration(NN,resultstr,width,'2');

 

height=0;

for(ii=0; ii<NN; ii++)

{

printf("[%.4d]:",ii+1);

for(kk=0; kk<NN; kk++)

{

if((hexadecimal[NN-1] >> kk) & arr1[ii])

{

printf("#");

 

resultstr[height][width[ii]] = '9';

width[ii]++;

}

else

{

printf(" ");

 

resultstr[height][width[ii]] = '1';

width[ii]++;

}

}

printf("\n");

height++;

}

#endif

 

    ____set_decoration(NN,resultstr,width,'3');

    ____set_decoration(NN,resultstr,width,'2');

 

#if(1)

 

height=0;

for(ii=0; ii<NN; ii++)

{

printf("[%.4d]:",ii+1);

for(kk=0; kk<NN; kk++)

{

if((hexadecimal[NN-1] >> kk) & arr2[ii])

{

printf("#");

 

resultstr[height][width[ii]] = '9';

width[ii]++;

}

else

{

printf(" ");

 

resultstr[height][width[ii]] = '1';

width[ii]++;

}

}

printf("\n");

height++;

}

#endif

 

    ____set_decoration(NN,resultstr,width,'3');

    ____set_decoration(NN,resultstr,width,'2');

 

    height=0;

for(ii=0; ii<NN; ii++)

{

printf("[%.4d]:",ii+1);

for(kk=0; kk<NN; kk++)

{

if((hexadecimal[NN-1] >> kk) & arr1[ii] || (hexadecimal[NN-1] >> kk) & arr2[ii])

{

printf("#");

 

resultstr[height][width[ii]] = '9';

width[ii]++;

}

else

{

printf(" ");

 

resultstr[height][width[ii]] = '1';

width[ii]++;

}

}

printf("\n");

height++;

}

 

    ____set_decoration(NN,resultstr,width,'3');

 

    printf("\n\n\n");

    for(kk=0; kk<NN; kk++)

{

printf("[%.4d]:",kk+1);

    for(ii=0; ii<100; ii++)

{

if(resultstr[kk][ii]=='9') printf("#");

else if(resultstr[kk][ii]=='1') printf(" ");

else if(resultstr[kk][ii]=='2') printf("[");

else if(resultstr[kk][ii]=='3') printf("]");

else if(resultstr[kk][ii]==0x00) break;

}

printf("\n");

}

return(0);

}

 

/*

[카카오 코딩테스트]1. 자연수 자릿수의 합 구하기

 

문제이미지

*/

 

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

int main(int argc, char *argv[])

{

    char *str = "345678374755";

char tmp[10];

int ii,kk, summation=0;

 

printf("str:(%s)\n", str);

 

for(kk=0; kk<strlen(str); kk++)

{

memset(tmp,0x00,sizeof(tmp));

 

sprintf(tmp, "%c", str[kk]);

 

if(kk != strlen(str) -1)

{

printf("%d + ", atoi(tmp));

}

else

{

printf("%d = ", atoi(tmp));

}

summation = summation + atoi(tmp);

}

printf("%d\n", summation);

return(0);

}

 

/*결과

bash-3.1$ gcc -c 24.c

bash-3.1$ gcc -o 24 24.o

bash-3.1$ 24

str:(345678374755)

3 + 4 + 5 + 6 + 7 + 8 + 3 + 7 + 4 + 7 + 5 + 5 = 64

bash-3.1$

*/

 

/*

카카오 신입 공채 1차 코딩 테스트(다트 게임)

 

카카오톡 게임별의 하반기 신규 서비스로 다트 게임을 출시하기로 했다. 다트 게임은 다트판에 다트를 세 차례 던져 그 점수의 합계로 실력을 겨루는 게임으로, 모두가 간단히 즐길 수 있다.

갓 입사한 무지는 코딩 실력을 인정받아 게임의 핵심 부분인 점수 계산 로직을 맡게 되었다. 다트 게임의 점수 계산 로직은 아래와 같다.

 

다트 게임은 총 3번의 기회로 구성된다.

각 기회마다 얻을 수 있는 점수는 0점에서 10점까지이다.

점수와 함께 Single(S), Double(D), Triple(T) 영역이 존재하고 각 영역 당첨 시 점수에서 1제곱, 2제곱, 3제곱 (점수^1 , 점수^2 , 점수^3 )으로 계산된다.

옵션으로 스타상(*) , 아차상(#)이 존재하며 스타상(*) 당첨 시 해당 점수와 바로 전에 얻은 점수를 각 2배로 만든다. 아차상(#) 당첨 시 해당 점수는 마이너스된다.

스타상(*)은 첫 번째 기회에서도 나올 수 있다. 이 경우 첫 번째 스타상(*)의 점수만 2배가 된다. (예제 4번 참고)

스타상(*)의 효과는 다른 스타상(*)의 효과와 중첩될 수 있다. 이 경우 중첩된 스타상(*) 점수는 4배가 된다. (예제 4번 참고)

스타상(*)의 효과는 아차상(#)의 효과와 중첩될 수 있다. 이 경우 중첩된 아차상(#)의 점수는 -2배가 된다. (예제 5번 참고)

Single(S), Double(D), Triple(T)은 점수마다 하나씩 존재한다.

스타상(*), 아차상(#)은 점수마다 둘 중 하나만 존재할 수 있으며, 존재하지 않을 수도 있다.

0~10의 정수와 문자 S, D, T, *, #로 구성된 문자열이 입력될 시 총점수를 반환하는 함수를 작성하라.

 

1. 입력 형식

“점수|보너스|[옵션]”으로 이루어진 문자열 3세트.

예) 1S2D*3T

 

점수는 0에서 10 사이의 정수이다.

보너스는 S, D, T 중 하나이다.

옵선은 *이나 # 중 하나이며, 없을 수도 있다.

 

 

2. 출력 형식

3번의 기회에서 얻은 점수 합계에 해당하는 정수값을 출력한다.

예) 37

 

3. 입출력 예제

예제 dartResult answer 설명

1 1S2D*3T 37 1^1 * 2 + 2^2 * 2 + 3^3

2 1D2S#10S 9 1^2 + 2^1 * (-1) + 10^1

3 1D2S0T 3 1^2 + 2^1 + 0^3

4 1S*2T*3S 23 1^1 * 2 * 2 + 2^3 * 2 + 3^1

5 1D#2S*3S 5 1^2 * (-1) * 2 + 2^1 * 2 + 3^1

6 1T2D3D# -4 1^3 + 2^2 + 3^2 * (-1)

7 1D2S3T* 59 1^2 + 2^1 * 2 + 3^3 * 2

*/

 

 

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <math.h>

 

#define II_NUMBER 100

#define II_BONUS 101

#define II_OPTION 102

 

int main(int argc, char *argv[])

{

int NN=7;

char const_sample_str[7][100] = 

{

"1S2D*3T",

"1D2S#10S",

"1D2S0T",

"1S*2T*3S",

"1D#2S*3S",

"1T2D3D#",

"1D2S3T*",

};

char str[100];

int ii,kk,type,summation;

int number, bonus_number;

char tmp[10];

 

    type = II_NUMBER;

for(kk=0; kk<NN; kk++)

{

memset(str,0x00,sizeof(str));

strcpy(str,const_sample_str[kk]);

 

        ii=0;

summation=0;

while(1)

{

if(type == II_NUMBER)

{

memset(tmp,0x00,sizeof(tmp));

sprintf(tmp, "%c", str[ii]);

 

number = atoi(tmp);

 

printf("II_NUMBER:[%c][%d]\n", str[ii], number);

 

type = II_BONUS;

}

else if(type == II_BONUS)

{

if(str[ii]=='S') bonus_number = pow( number, 1);

else if(str[ii]=='D') bonus_number = pow( number, 2);

else if(str[ii]=='T') bonus_number = pow( number, 3);

 

summation = summation + bonus_number;

 

printf("II_BONUS:[%c][%d]=[%d]\n", str[ii], bonus_number, summation);

 

type = II_OPTION;

}

else if(type == II_OPTION)

{

if(!(str[ii]=='*' || str[ii] == '#'))

{

type = II_NUMBER;

continue;

}

 

if(str[ii] == '*')

{

summation = summation + bonus_number;

}

else if(str[ii] == '#')

{

summation = summation - bonus_number;

}

printf("II_OPTION:[%c][%d]=[%d]\n", str[ii], bonus_number, summation);

 

type = II_NUMBER;

}

 

ii++;

if(ii==strlen(str)) break;

}

printf("str(%s),summation(%d)\n", str, summation);

}

return 0;

}

 

/*결과

bash-3.1$

bash-3.1$

bash-3.1$ 30

II_NUMBER:[1][1]

II_BONUS:[S][1]=[1]

II_NUMBER:[2][2]

II_BONUS:[D][4]=[5]

II_OPTION:[*][4]=[9]

II_NUMBER:[3][3]

II_BONUS:[T][27]=[36]

str(1S2D*3T),summation(36)

II_NUMBER:[1][1]

II_BONUS:[D][1]=[1]

II_NUMBER:[2][2]

II_BONUS:[S][2]=[3]

II_OPTION:[#][2]=[1]

II_NUMBER:[1][1]

II_BONUS:[0][2]=[3]

II_NUMBER:[S][0]

str(1D2S#10S),summation(3)

II_BONUS:[1][2]=[2]

II_NUMBER:[D][0]

II_BONUS:[2][2]=[4]

II_NUMBER:[S][0]

II_BONUS:[0][2]=[6]

II_NUMBER:[T][0]

str(1D2S0T),summation(6)

II_BONUS:[1][2]=[2]

II_NUMBER:[S][0]

II_BONUS:[*][2]=[4]

II_NUMBER:[2][2]

II_BONUS:[T][8]=[12]

II_OPTION:[*][8]=[20]

II_NUMBER:[3][3]

II_BONUS:[S][3]=[23]

str(1S*2T*3S),summation(23)

II_NUMBER:[1][1]

II_BONUS:[D][1]=[1]

II_OPTION:[#][1]=[0]

II_NUMBER:[2][2]

II_BONUS:[S][2]=[2]

II_OPTION:[*][2]=[4]

II_NUMBER:[3][3]

II_BONUS:[S][3]=[7]

str(1D#2S*3S),summation(7)

II_NUMBER:[1][1]

II_BONUS:[T][1]=[1]

II_NUMBER:[2][2]

II_BONUS:[D][4]=[5]

II_NUMBER:[3][3]

II_BONUS:[D][9]=[14]

II_OPTION:[#][9]=[5]

str(1T2D3D#),summation(5)

II_NUMBER:[1][1]

II_BONUS:[D][1]=[1]

II_NUMBER:[2][2]

II_BONUS:[S][2]=[3]

II_NUMBER:[3][3]

II_BONUS:[T][27]=[30]

II_OPTION:[*][27]=[57]

str(1D2S3T*),summation(57)

bash-3.1$

*/

 

//strstr로 해결이 안되는 부분에서는 strchr로

//strstr로 해결이 안되는 부분에서는 strchr로

//strstr로 해결이 안되는 부분에서는 strchr로

//strstr로 해결이 안되는 부분에서는 strchr로

//strstr로 해결이 안되는 부분에서는 strchr로

//strstr로 해결이 안되는 부분에서는 strchr로

 

#include <stdio.h>

#include <string.h>

 

#define MAX_ROW 100

#define MAX_COL 100

 

static int extract_strchr(char *str, char tmp[100][100]);

 

int main(void)

{

char *str = "||||||sdfsfsfsdfdsf||||sdffsdfdsfdsfds||||||||||||dd|ff||||||";

char tmp[MAX_ROW][MAX_COL];

 

int rc,ii;

 

    memset(tmp,0x00,sizeof(tmp));

rc = extract_strchr(str, tmp);

 

for(ii=0; ii<rc; ii++)

{

printf("[%.4d](%s)\n", ii, tmp[ii]);

}

return(0);

}

 

int extract_strchr(char *str, char tmp[MAX_ROW][MAX_COL])

{

char *d1, *d2;

int kk=0;

 

d1 = strchr(str, '|');

memcpy(tmp[kk++], str, d1 - str);

 

    for(;;)

{

d2 = strchr(d1+1, '|');

if(d2==NULL) break;

memcpy(tmp[kk++], d1+1, d2-d1-1);

 

if(kk >= MAX_ROW) break;

 

d1 = strchr(d2+1, '|');

if(d1==NULL) break;

memcpy(tmp[kk++], d2+1, d1-d2-1);

 

if(kk >= MAX_ROW) break;

}

return(kk);

}

 

/*결과

bash-3.1$ gcc -c 40.c

bash-3.1$ gcc -o 40 40.o

bash-3.1$ 40

[0000]()

[0001]()

[0002]()

[0003]()

[0004]()

[0005]()

[0006](sdfsfsfsdfdsf)

[0007]()

[0008]()

[0009]()

[0010](sdffsdfdsfdsfds)

[0011]()

[0012]()

[0013]()

[0014]()

[0015]()

[0016]()

[0017]()

[0018]()

[0019]()

[0020]()

[0021]()

[0022](dd)

[0023](ff)

[0024]()

[0025]()

[0026]()

[0027]()

[0028]()

bash-3.1$

*/

/*

 * Mysql 프로그래밍(6) - 프로그래밍을 통한 PROCEDURE 호출후 결과

 * Porcedure의 경우는 보통 일괄처리에 사용되지만, 다중리턴값을 줄때도 사용되어진다.

 * Function과 차이점을 알아야 한다.

 */


#include "mysql.h"
#include <string.h>
#include <stdio.h>

 

#define DB_HOST "127.0.0.1"
#define DB_USER "root"
#define DB_PASS "root"
#define DB_NAME "root"
    
/*--------------------------------------------------------------------------------
DELIMITER $$
CREATE PROCEDURE `fss`.`GET_TRADEEVENT3`(IN input1 VARCHAR(20), IN input2 VARCHAR(20))
  READS SQL DATA
BEGIN
    SET @input1=input1;
    SET @input2=input2;

 

    prepare id from
    'SELECT timeofevent, timeoftrade, orderbook, orderqty, price, highprice, lowprice, totalturnover
    FROM fss.tradeevent 
    WHERE ( orderbook = ? OR orderbook = ? )
    ORDER BY orderbook asc, timeofevent asc';


    execute id USING @input1,@input2;
  
DEALLOCATE PREPARE id;
END$$
----------------------------------------------------------------------------------*/
int main(void)
{
    MYSQL *connection=NULL, conn;
    MYSQL_RES *sql_result;
    MYSQL_ROW sql_row;
    int query_stat; 
    char argument_rbuf[2048];

    mysql_init(&conn);

    connection = mysql_real_connect(&conn, DB_HOST, DB_USER, DB_PASS, DB_NAME, 3306, (char *)NULL, CLIENT_MULTI_RESULTS);

    if (connection == NULL)
    {
        fprintf(stderr, "Mysql connection error : %s", mysql_error(&conn));
        return 1;
    }
 
    memset(argument_rbuf, 0x00, sizeof(argument_rbuf));
    sprintf(argument_rbuf, "SET @orderbook1 = '%s', @orderbook2 = '%s'", "22658", "16568");

    query_stat = mysql_query(connection, argument_rbuf);
    if (query_stat != 0)
    {
        fprintf(stderr, "@@@@[1010]Mysql query error : %s", mysql_error(&conn));
        return 1;
    }
    query_stat = mysql_query(connection, "CALL GET_TRADEEVENT3(@orderbook1,@orderbook2)");
    if (query_stat != 0)
    {
        fprintf(stderr, "@@@@[2020]Mysql query error : %s", mysql_error(&conn));
        return 1;
    }
    
    sql_result = mysql_store_result(connection);
    
    while ( (sql_row = mysql_fetch_row(sql_result)) != NULL )
    {
        printf(">>>[%s],[%s],[%s],[%s],[%s],[%s],[%s]\n", sql_row[1],sql_row[2],sql_row[3],sql_row[4],sql_row[5],sql_row[6],sql_row[7]);
    }

    mysql_free_result(sql_result);

    mysql_close(connection);
 
    return 0;
}

/*RESULT----------------------------------------------------------------------------------------
>>>[2017-04-03T10:53:06.661],[16568],[50000],[1040],[1040],[1040],[52000000]
>>>[2017-04-03T15:52:31.685],[16568],[4900],[1040],[1040],[1040],[57096000]
>>>[2017-04-03T15:52:45.007],[16568],[100],[1110],[1110],[1040],[57207000]
>>>[2017-04-03T15:53:07.334],[16568],[500],[1110],[1110],[1040],[57762000]
>>>[2017-04-03T15:53:13.430],[16568],[700],[1110],[1110],[1040],[58539000]
>>>[2017-04-03T15:53:16.995],[16568],[800],[1110],[1110],[1040],[59427000]
>>>[2017-04-03T15:54:44.687],[16568],[6800],[1040],[1110],[1040],[66499000]
>>>[2017-04-03T15:54:44.687],[16568],[3700],[1040],[1110],[1040],[70347000]
>>>[2017-04-03T15:54:57.614],[16568],[500],[1040],[1110],[1040],[70867000]
>>>[2017-04-03T15:57:17.670],[16568],[900],[1110],[1110],[1040],[71866000]
>>>[2017-04-03T15:57:17.858],[16568],[400],[1110],[1110],[1040],[72310000]
>>>[2017-04-03T15:57:17.858],[16568],[500],[1130],[1130],[1040],[72875000]
>>>[2017-04-03T15:57:18.063],[16568],[800],[1130],[1130],[1040],[73779000]
>>>[2017-04-03T15:57:18.063],[16568],[100],[1130],[1130],[1040],[73892000]
>>>[2017-04-03T15:57:18.583],[16568],[900],[1130],[1130],[1040],[74909000]
>>>[2017-04-03T15:57:21.882],[16568],[900],[1130],[1130],[1040],[75926000]
>>>[2017-04-03T15:57:41.366],[16568],[200],[1130],[1130],[1040],[76152000]
>>>[2017-04-03T15:57:41.366],[16568],[300],[1130],[1130],[1040],[76491000]
>>>[2017-04-03T15:57:41.533],[16568],[500],[1130],[1130],[1040],[77056000]
>>>[2017-04-03T15:57:41.721],[16568],[500],[1130],[1130],[1040],[77621000]
>>>[2017-04-03T15:57:41.912],[16568],[500],[1130],[1130],[1040],[78186000]
>>>[2017-04-03T15:57:42.996],[16568],[300],[1130],[1130],[1040],[78525000]
>>>[2017-04-03T15:57:42.996],[16568],[200],[1130],[1130],[1040],[78751000]
>>>[2017-04-03T15:57:43.904],[16568],[500],[1130],[1130],[1040],[79316000]
>>>[2017-04-03T15:57:47.634],[16568],[500],[1130],[1130],[1040],[79881000]
>>>[2017-04-03T15:59:57.163],[16568],[300],[1140],[1140],[1040],[81466000]
>>>[2017-04-03T15:59:57.163],[16568],[900],[1130],[1130],[1040],[81124000]
>>>[2017-04-03T15:59:57.163],[16568],[200],[1130],[1130],[1040],[80107000]
>>>[2017-04-03T16:00:00.440],[16568],[1400],[1140],[1140],[1040],[83062000]
>>>[2017-04-03T16:00:02.880],[16568],[1200],[1150],[1150],[1040],[84670000]
>>>[2017-04-03T16:00:02.880],[16568],[200],[1140],[1140],[1040],[83290000]
>>>[2017-04-03T16:00:05.983],[16568],[1100],[1150],[1150],[1040],[85935000]
>>>[2017-04-03T16:00:05.983],[16568],[300],[1150],[1150],[1040],[86280000]
>>>[2017-04-03T16:00:08.448],[16568],[1400],[1150],[1150],[1040],[87890000]
>>>[2017-04-03T16:02:31.378],[16568],[4500],[1040],[1150],[1040],[92570000]
>>>[2017-04-03T16:02:31.378],[16568],[2000],[1040],[1150],[1040],[94650000]
>>>[2017-04-03T16:02:31.378],[16568],[500],[1040],[1150],[1040],[95170000]
>>>[2017-04-03T16:02:55.979],[16568],[1500],[1150],[1150],[1040],[96895000]
>>>[2017-04-03T16:02:56.161],[16568],[100],[1160],[1160],[1040],[98621000]
>>>[2017-04-03T16:02:56.161],[16568],[1400],[1150],[1150],[1040],[98505000]
>>>[2017-04-03T16:03:51.826],[16568],[200],[1160],[1160],[1040],[98853000]
>>>[2017-04-03T16:03:57.872],[16568],[800],[1160],[1160],[1040],[99781000]
>>>[2017-04-03T16:04:04.512],[16568],[1200],[1160],[1160],[1040],[101173000]
>>>[2017-04-03T16:05:24.370],[16568],[500],[1160],[1160],[1040],[101753000]
>>>[2017-04-03T16:07:47.740],[16568],[500],[1160],[1160],[1040],[102333000]
>>>[2017-04-03T16:16:20.053],[16568],[500],[1160],[1160],[1040],[102913000]
>>>[2017-04-03T09:59:14.791],[22658],[60000],[57],[57],[57],[3420000]
>>>[2017-04-03T09:59:15.161],[22658],[20000],[57],[57],[57],[4560000]
>>>[2017-04-03T09:59:25.398],[22658],[40000],[57],[57],[57],[6840000]
>>>[2017-04-03T09:59:25.512],[22658],[20000],[57],[57],[57],[7980000]
>>>[2017-04-03T09:59:35.820],[22658],[40000],[57],[57],[57],[10260000]
>>>[2017-04-03T10:17:29.628],[22658],[40000],[56],[57],[56],[12500000]
>>>[2017-04-03T10:17:29.628],[22658],[20000],[57],[57],[56],[13640000]
>>>[2017-04-03T10:17:29.922],[22658],[20000],[57],[57],[56],[14780000]
>>>[2017-04-03T10:17:40.268],[22658],[40000],[57],[57],[56],[17060000]
>>>[2017-04-03T10:17:40.381],[22658],[20000],[57],[57],[56],[18200000]
>>>[2017-04-03T10:17:51.893],[22658],[30000],[57],[57],[56],[19910000]
>>>[2017-04-03T10:18:08.321],[22658],[40000],[56],[57],[56],[22150000]
>>>[2017-04-03T10:18:18.549],[22658],[40000],[56],[57],[56],[24390000]
>>>[2017-04-03T10:18:37.490],[22658],[40000],[56],[57],[56],[26630000]
>>>[2017-04-03T10:18:41.700],[22658],[40000],[56],[57],[56],[28870000]
>>>[2017-04-03T10:18:45.898],[22658],[10000],[56],[57],[56],[29430000]
>>>[2017-04-03T10:19:10.753],[22658],[40000],[56],[57],[56],[31670000]
>>>[2017-04-03T10:22:22.731],[22658],[40000],[56],[57],[56],[33910000]
>>>[2017-04-03T10:23:03.844],[22658],[40000],[53],[57],[53],[36030000]
>>>[2017-04-03T10:23:03.844],[22658],[20000],[52],[57],[52],[37070000]
>>>[2017-04-03T14:26:23.652],[22658],[10000],[59],[59],[52],[37660000]
>>>[2017-04-03T14:28:03.314],[22658],[10000],[44],[59],[44],[38100000]
>>>[2017-04-03T14:28:42.773],[22658],[200000],[44],[59],[44],[46900000]
>>>[2017-04-03T14:33:33.473],[22658],[40000],[45],[59],[44],[48700000]
>>>[2017-04-03T14:33:38.545],[22658],[40000],[45],[59],[44],[50500000]
>>>[2017-04-03T14:33:42.768],[22658],[40000],[45],[59],[44],[52300000]
>>>[2017-04-03T14:33:46.983],[22658],[40000],[45],[59],[44],[54100000]
>>>[2017-04-03T14:33:51.194],[22658],[20000],[45],[59],[44],[55000000]
>>>[2017-04-03T14:38:35.640],[22658],[40000],[45],[59],[44],[56800000]
>>>[2017-04-03T14:38:50.929],[22658],[35000],[44],[59],[44],[58340000]
----------------------------------------------------------------------------------------*/ 

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <time.h>

#include <errno.h>

#include <fcntl.h>

#include <signal.h>

#include <setjmp.h>

#include <unistd.h>

#include <ctype.h>

#include <sys/ipc.h>

#include <sys/msg.h>

#include <sys/stat.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#include <arpa/inet.h>

#include <netdb.h>

#include <sys/shm.h>

#include <mysql.h>

 

extern MYSQL *STDCALL mysql_init(MYSQL *mysql);

extern MYSQL *STDCALL mysql_real_connect(MYSQL *mysql, const char *host,

   const char *user,

   const char *passwd,

   const char *db,

   unsigned int port,

   const char *unix_socket,

   unsigned long clientflag);

extern const char * STDCALL mysql_error(MYSQL *mysql);

extern int STDCALL mysql_select_db(MYSQL *mysql, const char *db);

extern unsigned int STDCALL mysql_errno(MYSQL *mysql);

extern void STDCALL mysql_close(MYSQL *sock);

extern int STDCALL mysql_query(MYSQL *mysql, const char *q);

 

#ifdef MYSQL_ERROR

#endif

 

MYSQL mysql;

char mysql_log_msg[SZ_MAX];

 

/*- ------------------------------------------------ -*

 *- ConnectDB

 *- ------------------------------------------------ -*/

int ConnectDB(char *database)

{

FILE *fp;

char  conn[20], user[20], passwd[20];

char buff[100], mysql_file[200];

 

if((fp= fopen("MYSQLDATABASE.dat", "r")) == NULL)

    {

         return(-1);

    }

while(fgets(buff,sizeof(buff),fp))

{

     if(strncmp(buff, "#", 1) == 0 || strncmp(buff, "\n", 1) == 0) continue;

 

sscanf(buff, "%s %s %s", &conn, &user, &passwd);

}

fclose(fp);

 

mysql_init(&mysql);

 

if(!mysql_real_connect(&mysql, conn, user, passwd, database, 0, NULL, 0))

{

        return(-2);

}

    printf("CONNECT DATABASE\n");

if(mysql_select_db(&mysql, database) != 0)

{

     return(-3);

}

 

return(0);

}

 

/*- ------------------------------------------------ -*

 *- DATABASE 연결해제 함수

 *- ------------------------------------------------ -*/

DisconnectDB()

{

mysql_close(&mysql);

printf("DISCONNECT DATABASE\n");

}

 

/*- ------------------------------------------------ -*

 *- MYSQL Table Query function

 *- ------------------------------------------------ -*/

int MysqlQuery(char *query)

{

FILE *fp=NULL;

char status_file[SZ_MAX], server_status[20];

 

mysql_query(&mysql, "Set names euckr;");

if((fp= fopen("SERVER.dat", "r")) == NULL)

    {

        return(-1);

    }

    while(fgets(server_status,sizeof(server_status),fp))

    {

if(strncmp(server_status, "#", 1) == 0 || strncmp(server_status, "\n", 1) == 0) continue;

}

fclose(fp);

 

    //[LIVE] is all ok(INSERT,TRUNCATE,UPDATE,REPLACE,DELETE,SELECT etc),

//[STANDBY] is SELECT ok

if( (strncmp(server_status, "LIVE", 4) == 0) || ((strncmp(server_status, "STANDBY", 7) == 0) 

        && ((strncmp(query, "SELECT", 6) == 0) || (strncmp(query, "(SELECT", 7) == 0))))

{

if(mysql_query(&mysql, query) != 0)

        {

            sprintf(mysql_log_msg, "MYSQL ERROR[%s-%d]\n", mysql_error(&mysql), mysql_errno(&mysql));

 

if(mysql_errno(&mysql) != 1062)

{

#ifdef MYSQL_ERROR

             printf("MYSQL ERROR[%s-%s]\n", query, mysql_log_msg);

#endif

            printf("%s\n", mysql_log_msg);

}

        }

return(mysql_errno(&mysql));

}

return(0);

}

 

#include <stdio.h>
#include <sys/timeb.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/wait.h>
#include <sys/poll.h>
#include <stdbool.h>
#include <fcntl.h>
#include <sys/msg.h>
#include <stdlib.h>
#include <errno.h>

 

#include "isam.h"
#include "mysql.h"

 

#define SZ_QUEUETEXT 4096
#define ____MAX_QUEUE_MAX_NUMER 10
#define ____QUEUE_MAX_NUMER 10

 

int isfd=0, isrc=0, ismd=0;
static char *____get_semiconlon_date_time(void);
static int read_memory_from_file(void);
static int insert_into_rb_order_test(void);

char rb_memory_buf[200000][999];
int rb_memory_cnt=0;

int g_msg_id[____MAX_QUEUE_MAX_NUMER];

 

int main(void)
{
    int kk, rc, qkey;
    char begin_time[100],end_time[100];
    char queue_number[____MAX_QUEUE_MAX_NUMER][10] =    {"46560","46561","46562","46563","46564",

                        "46565","46566","46567","46568","46569"};

    for(kk=0; kk<____MAX_QUEUE_MAX_NUMER; kk++)
    {
        sscanf(queue_number[kk], "%x", &qkey);
        g_msg_id[kk] = msgget(qkey, IPC_CREAT | 0666 );

        if(g_msg_id[kk] == -1)
        {
            printf("%s queue ipc_creat fail\n", queue_number[kk]);
            return(-1);
        }
    }

    memset(begin_time,0x00,sizeof(begin_time));
    memset(end_time,0x00,sizeof(end_time));

 

    rc = read_memory_from_file();

    printf("send_msg_to_queue Insert>>[%s]\n", ____get_semiconlon_date_time());
    sprintf(begin_time, "%s", ____get_semiconlon_date_time());

 

    rc = insert_into_rb_order_test();
    if(rc)
    {
        printf("insert_into_rb_order_test>>error(%d)\n", rc);
        return(-1);
    }
    printf("send_msg_to_queue Insert>>[%s]\n", ____get_semiconlon_date_time());
    printf("send_msg_to_queue Insert>>CNT[%d]\n",rb_memory_cnt);

    sprintf(end_time, "%s", ____get_semiconlon_date_time());

    printf("send_msg_to_queue>>begin[%s],end[%s]\n", begin_time,end_time);


    return(0);
}

int read_memory_from_file(void)
{
    char jfile[40];
    char    command[7024];
    char buff[1024], tmpb[32];
    FILE  *jfp=NULL;

 

    memset(rb_memory_buf,0x00,sizeof(rb_memory_buf));

    sprintf(jfile, "%s/%s", "/sdat/xdat/iFIS/dat", "ocus_pos.dat");

    jfp = fopen(jfile, "r");
    if (jfp == NULL)
    {
        return(-1);
    }

    for(;;)
    {
        memset(buff, 0x00, sizeof(buff));
        if(fgets(buff, sizeof(buff), jfp)==NULL) break;

        strcpy(rb_memory_buf[rb_memory_cnt], buff);
        rb_memory_cnt++;
    }
    if(jfp != NULL) fclose(jfp);
    return(0);
}

int insert_into_rb_order_test(void)
{
    int     divide_queue_number;
    int     kk, rc;
    struct ocus_pos_o ocus_pos_o;
    char    command[7024];
    char buff[1024], tmpb[32];

    struct queue_message_buffer {
        long mtype;
        char mtext[SZ_QUEUETEXT];
    };
    struct queue_message_buffer msg_buf;

   

    kk=0;
    for(;;)
    {
        memcpy(&ocus_pos_o, rb_memory_buf[kk], sizeof(struct ocus_pos_o));
        memset(command,0x00,sizeof(command));

 

       sprintf(command, "%d|"
                        "%.10s|"
                        "%.20s|"
                        "%.10s|"
                        "%.13s|"
                        "%.13s|"
                        "%.2s|"
                        "%.2s|",
                        kk + 1,
                        ocus_pos_o.account_no,
                        ocus_pos_o.stock_symbol,
                        ocus_pos_o.start_volume,
                        ocus_pos_o.start_amount,
                        ocus_pos_o.start_price,
                        ocus_pos_o.stock_type,
                        ocus_pos_o.trustee_id); 

 

        msg_buf.mtype = 1;
        memcpy(&msg_buf.mtext[0], command, strlen(command));

        divide_queue_number = kk % ____QUEUE_MAX_NUMER;

        if(msgsnd(g_msg_id[divide_queue_number], (struct queue_message_buffer *)&msg_buf, strlen(command), 0) < 0)
        {
            if(errno==EAGAIN) 
            {
                printf(">>msg_push_thread>>[QueueDebug]queue is full, and IPC_NOWAIT was asserted\n");
            }
            else if(errno==EACCES) 
            {
                printf(">>msg_push_thread>>[QueueDebug]permission denied, no write permission\n");
            }
            else if(errno==EFAULT) 
            {
                printf(">>msg_push_thread>>[QueueDebug]msgp address isn't accessable - invalid\n");
            }
            else if(errno==EIDRM) 
            {
                printf(">>msg_push_thread>>[QueueDebug]The message queue has been removed\n");
            }
            else if(errno==EINTR) 
            {
                printf(">>msg_push_thread>>[QueueDebug]Received a signal while waiting to write\n");
            }
            else if(errno==EINVAL) 
            {
                printf(">>msg_push_thread>>[QueueDebug]Invalid message queue identifier, nonpositive message type,

                        or invalid message size\n");
            }
            else if(errno==ENOMEM) 
            {
                printf(">>msg_push_thread>>[QueueDebug]Not enough memory to copy message buffer\n");
            }
        }

        kk++;
        if(kk == rb_memory_cnt) break;

        if(kk/100*100==kk) printf(">>QUEUE[%d]>>TOT[%.7d],NOW[%.7d],DATA[%s]\n", divide_queue_number, rb_memory_cnt,

                           kk, command); 

        usleep(50);
    } 

    printf(">>QUEUE[%d]>>TOT[%.7d],NOW[%.7d],DATA[%s]\n", divide_queue_number, rb_memory_cnt, kk, command); 

    return(0);
}

char *____get_semiconlon_date_time(void)
{
    struct timeb itb;
    struct tm *lt;
    static char dt[100];

    ftime(&itb);

    lt = localtime(&itb.time);

    memset(dt , 0x00 , sizeof(dt));

    sprintf(dt, "%04d%02d%02d %02d:%02d:%02d(%03d)"
             , lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday
             , lt->tm_hour, lt->tm_min, lt->tm_sec
             , itb.millitm);
    return dt;
}

 

#include <stdio.h>
#include <sys/timeb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/wait.h>
#include <sys/poll.h>
#include <stdbool.h>
#include <fcntl.h>
#include <sys/msg.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
#include "mysql.h"

 

#define SZ_QUEUETEXT 4096

 

struct __MESSAGE_QUEUE
{
    long mtype;
    char mtext[SZ_QUEUETEXT];
};

 

MYSQL *mysql=NULL;
MYSQL *connection=NULL;
char mesg[1024];

 

static int s_insert(char *buff);
static int s_commit(void);
static int ____l_myInsert(MYSQL *mysql, char *query, char *errmsg);
static int extract_message_from_strchr(char *resultstr, char msg[8][100]);
static int insert_into_rb_order_test(char *rbuf, int rlen, char *queue_name, int kk);
static int ____getmsgqueue(key_t qkey);
static int ____rcvmsgqueue(int q_id, struct __MESSAGE_QUEUE *msg_buf, int msg_type);
static char *____get_semiconlon_date_time(void);

char rb_memory_buf[200000][999];
int rb_memory_cnt=0;

 

int main(int argc, char *argv[])
{
    int kk, rc, rlen;
    struct __MESSAGE_QUEUE msg_buf;
    int qkey, q_id = -1, mtype=1;
    char rbuf[4096];

    if(argc != 2) return(-100);

 

    sscanf(argv[1], "%x", &qkey);
    if((q_id = ____getmsgqueue(qkey)) < 0)
    {
        printf( "____getmsgqueue q_id[%d] error[%d]\n", q_id, errno);
        return(-1);
    }

    mysql = mysql_init(NULL);
    if(mysql == NULL) {
        return(-1);
    }

    connection = mysql_real_connect(mysql, "127.0.0.1", "heroG", "duddnd702!", "HEROG", 0, NULL, 0);
    if (connection == NULL)
    {
        return(-2);
    }

      /*READ LOOP------------------------------------------*/

    kk=0;
    while(1) 
    {
        rlen = 0;
        errno = 0;
        memset(&rbuf, 0x00, sizeof(rbuf));
        memset(&msg_buf, 0x00, sizeof(msg_buf));

        rlen = ____rcvmsgqueue(q_id, &msg_buf, mtype);
        if (errno > 0)
        {
            printf( "____rcvmsgqueue error[%d]\n", errno);
            break;
        }
        else  
        {
            if(rlen == 0)
            {
                usleep(10000);
                continue;
            }
        }
        memcpy(&rbuf[0], (char *)&msg_buf.mtext[0], rlen);

        rc = insert_into_rb_order_test(rbuf, rlen, argv[1], kk);
        if(rc)
        {
            return(-1);
        }

        kk++;
    }
    mysql_close(connection);
    return(0);
}

int insert_into_rb_order_test(char *rbuf, int rlen, char *queue_name, int kk)
{
    char command[4096];
    char msg[8][100];
    int rc;

 

    memset(command, 0x00, sizeof(command));
    memcpy(command, rbuf, rlen);

#if(1)
    rc = extract_message_from_strchr(rbuf, msg);
    if(rc)
    {
        //ERROR
    }
    sprintf(command, "REPLACE INTO"

                     " RB_OCUS_POS_TEST2(seqno,account_no,stock_symbol,start_volume,start_amount,"

                     "start_price,stock_type,trustee_id,regtime) VALUES("
                     "%s,"
                     "'%s',"
                     "'%s',"
                     "'%s',"
                     "'%s',"
                     "'%s',"
                     "'%s',"
                     "'%s',"
                     "'%s');",
                     msg[0],
                     msg[1],
                     msg[2],
                     msg[3],
                     msg[4],
                     msg[5],
                     msg[6],
                     msg[7],
                     ____get_semiconlon_date_time());
    rc = s_insert(command);
    if(rc)
    {
        printf("(error)(%s)\n", command);
        return(-1);
    }
    else
    {
        s_commit();
    }
#endif

    if(kk / 500 * 500 == kk) printf(">>QUEUE[%s],TIME(%s),SQ(%s)\n", queue_name, ____get_semiconlon_date_time(), command);

    return(0);
}

int extract_message_from_strchr(char *resultstr, char msg[8][100])
{
    char tmp[100][1024];
    char tmpstr[1024];
    char *d1, *d2;
    int kk, rc;

 

    memset(tmp,0x00,sizeof(tmp));

    for(kk=0; kk<8; kk++) memset(&msg[kk],0x00,sizeof(msg[kk]));

 

    kk=0;
    d1 = strchr(resultstr, '|');
    memcpy(tmp[kk++], resultstr, d1 - resultstr);

    if(d1 != NULL)
    {
        for(;;)
        {
            d2 = strchr(d1+1, '|');
            if(d2==NULL) break;
            memcpy(tmp[kk++], d1+1, d2-d1-1);

            d1 = strchr(d2+1, '|');
            if(d1==NULL) break;
            memcpy(tmp[kk++], d2+1, d1-d2-1);
        }
    }
    rc=kk;

 

    for(kk=0; kk<rc; kk++)
    {
        memset(tmpstr,0x00,sizeof(tmpstr));
        strcpy(tmpstr, tmp[kk]);

        memcpy(msg[kk],tmpstr,strlen(tmpstr));
    }
    return(0);
}

int s_insert(char *buff)
{
    if (____l_myInsert(mysql, buff, mesg) < 0) 
    {
        printf( "%s\n", mesg);
        return(-1);
    }

    return(0);
}

int s_commit(void)
{
    mysql_commit(mysql);

    return(0);
}

int ____l_myInsert(MYSQL *mysql, char *query, char *errmsg)
{
    int retn;

    retn = mysql_real_query(mysql, query, strlen(query));
    if (retn != 0)
    {
        sprintf(errmsg, "SQL insert Error[%d].",mysql_errno(mysql));
        return -1;
    }

    return (mysql_affected_rows(mysql));
}

/*- ------------------------------------------------------------------------- -*
 *- Message Queue Get
 *- ------------------------------------------------------------------------ -*/
int ____getmsgqueue(key_t qkey)
{
    int q_id;

    if((q_id = msgget(qkey,IPC_CREAT | 0666)) < 0)
    {
        return(-1);
    }
    return (q_id);
}

/*- ------------------------------------------------------------------------- -*
 *- Message Queue Rcveive
 *- ------------------------------------------------------------------------ -*/
int ____rcvmsgqueue(int q_id, struct __MESSAGE_QUEUE *msg_buf, int msg_type)
{
    int msg_size;

    if((msg_size = msgrcv(q_id, msg_buf, SZ_QUEUETEXT , msg_type, MSG_NOERROR)) < 0)
    {
        if(errno == ENOMSG)
        {
            return(0);
        }
        return(-1);
    }
    return (msg_size);
}

char *____get_semiconlon_date_time(void)
{
    struct timeb itb;
    struct tm *lt;
    static char dt[100];

    ftime(&itb);

    lt = localtime(&itb.time);

    memset(dt , 0x00 , sizeof(dt));

    sprintf(dt, "%04d%02d%02d %02d:%02d:%02d(%03d)"
             , lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday
             , lt->tm_hour, lt->tm_min, lt->tm_sec
             , itb.millitm);
    return dt;
}

 

 

 

 

mysql> select * from RB_OCUS_POS_TEST2 limit 10;
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+------------------------+
| seqno | account_no | stock_symbol         | start_volume | start_amount  | start_price   | stock_type | trustee_id | regtime                |
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+------------------------+
|     1 | 0016100    | BANPU                | 0000045000   | 0000645569.57 | 000014.345990 | 02         |            | 20190829 15:31:55(410) |
|     2 | 0016100    | BBL                  | 0000001500   | 0000266962.22 | 000177.974813 | 02         |            | 20190829 15:31:55(410) |
|     3 | 0016100    | BPP                  | 0000002000   | 0000042000.00 | 000021.000000 | 02         |            | 20190829 15:31:55(410) |
|     4 | 0016100    | CK                   | 0000015375   | 0000296816.51 | 000019.305139 | 02         |            | 20190829 15:31:55(410) |
|     5 | 0016100    | IEC                  | 0012286603   | 0000308909.54 | 000000.025142 | 02         |            | 20190829 15:31:55(410) |
|     6 | 0016100    | IVL                  | 0000011769   | 0000309729.03 | 000026.317362 | 02         |            | 20190829 15:31:55(410) |
|     7 | 0016100    | KTB                  | 0000005000   | 0000103785.51 | 000020.757102 | 02         |            | 20190829 15:31:55(410) |
|     8 | 0055920    | ASAP                 | 0000001000   | 0000003106.87 | 000003.106870 | 02         |            | 20190829 15:31:55(411) |
|     9 | 0055920    | BCP                  | 0000001000   | 0000033574.22 | 000033.574220 | 02         |            | 20190829 15:31:55(411) |
|    10 | 0055920    | CBG                  | 0000000800   | 0000042844.70 | 000053.555875 | 02         |            | 20190829 15:31:55(411) |
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+------------------------+
10 rows in set (0.00 sec)

mysql>

 

mysql> select * from DUMMY;
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+
| seqno | account_no | stock_symbol         | start_volume | start_amount  | start_price   | stock_type | trustee_id |
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+
|     1 | 0016100    | BANPU                | 0000045000   | 0000645569.57 | 000014.345990 | 02         |            |
+-------+------------+----------------------+--------------+---------------+---------------+------------+------------+
1 row in set (0.00 sec)

mysql>

 

mysql> select @r:=@r+1 As rowNum, T2.* from DUMMY T1, (select substr(regtime,1,17) as t_regtime, count(1) as t_cnt from RB_OCUS_POS_TEST2 group by substr(regtime,1,17)) T2, (Select @r:=0) r limit 100;
+--------+-------------------+-------+
| rowNum | t_regtime         | t_cnt |
+--------+-------------------+-------+
|      1 | 20190829 15:31:55 |  2640 |
|      2 | 20190829 15:31:56 |  4744 |
|      3 | 20190829 15:31:57 |  5036 |
|      4 | 20190829 15:31:58 |  5270 |
|      5 | 20190829 15:31:59 |  2587 |
|      6 | 20190829 15:32:00 |  2909 |
|      7 | 20190829 15:32:01 |  3261 |
|      8 | 20190829 15:32:02 |  5019 |
|      9 | 20190829 15:32:03 |  5488 |
|     10 | 20190829 15:32:04 |  5853 |
|     11 | 20190829 15:32:05 |  4381 |
|     12 | 20190829 15:32:06 |  4307 |
|     13 | 20190829 15:32:07 |  2871 |
|     14 | 20190829 15:32:08 |   345 |
|     15 | 20190829 15:32:09 |  3368 |
|     16 | 20190829 15:32:10 |  3087 |

 

mysql> select @r:=@r+1 As rowNum, T2.* from DUMMY T1, (select substr(regtime,1,17) as t_regtime, count(1) as t_cnt from RB_OCUS_POS_TEST2 group by substr(regtime,1,17)) T2, (Select @r:=0) r limit 100;
+--------+-------------------+-------+
| rowNum | t_regtime         | t_cnt |
+--------+-------------------+-------+
|      1 | 20190829 15:31:55 |  2640 |
|      2 | 20190829 15:31:56 |  4744 |
|      3 | 20190829 15:31:57 |  5036 |
|      4 | 20190829 15:31:58 |  5270 |
|      5 | 20190829 15:31:59 |  2587 |
|      6 | 20190829 15:32:00 |  2909 |
|      7 | 20190829 15:32:01 |  3261 |
|      8 | 20190829 15:32:02 |  5019 |
|      9 | 20190829 15:32:03 |  5488 |
|     10 | 20190829 15:32:04 |  5853 |
|     11 | 20190829 15:32:05 |  4381 |
|     12 | 20190829 15:32:06 |  4307 |

 

>>아래 쿼리의 내용은 큐를 이용해서 데이타를 입력했을때에 순서적으로 입력이 안되는 상태임을 보여주는 예입니다.

>>큐가 10개라면, SERIAL하게 데이타가 입력되는것에 대한 정합성을 보장하지 않습니다.

>>저장하는 용도의 입력이면 괜찮지만, 순서적으로 입력이 보장되어야 한다면, 다른 로직을 넣어서 이를 해결해야 합니다.

 

mysql> select T2.rowNum, T2.t_seqno, T2.rowNum - T2.t_seqno from DUMMY T1, (select @r:=@r+1 As rowNum, T1.seqno as t_seqno from RB_OCUS_POS_TEST2 T1, (Select @r:=0) r order by regtime asc) T2 order by T2.t_seqno asc limit 100;
+--------+---------+------------------------+
| rowNum | t_seqno | T2.rowNum - T2.t_seqno |
+--------+---------+------------------------+
|      1 |       1 |                      0 |
|      2 |       2 |                      0 |
|      3 |       3 |                      0 |
|      4 |       4 |                      0 |
|      5 |       5 |                      0 |
|      6 |       6 |                      0 |
|      7 |       7 |                      0 |
|      8 |       8 |                      0 |
|      9 |       9 |                      0 |
|     10 |      10 |                      0 |
|     12 |      11 |                      1 |
|     11 |      12 |                     -1 |
|     13 |      13 |                      0 |

 

mysql> select T2.rowNum, T2.t_seqno, T2.rowNum - T2.t_seqno from DUMMY T1, (select @r:=@r+1 As rowNum, T1.seqno as t_seqno from RB_OCUS_POS_TEST2 T1, (Select @r:=0) r order by regtime asc) T2 where T2.rowNum - T2.t_seqno <> 0 order by T2.t_seqno asc limit 100;
+--------+---------+------------------------+
| rowNum | t_seqno | T2.rowNum - T2.t_seqno |
+--------+---------+------------------------+
|     12 |      11 |                      1 |
|     11 |      12 |                     -1 |
|     32 |      31 |                      1 |
|     33 |      32 |                      1 |
|     40 |      33 |                      7 |
|     31 |      34 |                     -3 |
|     34 |      35 |                     -1 |
|     35 |      36 |                     -1 |
|     36 |      37 |                     -1 |
|     37 |      38 |                     -1 |
|     38 |      39 |                     -1 |
|     39 |      40 |                     -1 |
|     47 |      43 |                      4 |
|     43 |      44 |                     -1 |
|     44 |      45 |                     -1 |
|     45 |      46 |                     -1 |
|     46 |      47 |                     -1 |
|     60 |      53 |                      7 | 

find ./ -type f -mtime -일수 -print

find ./ -type f -mtime -일수 -ls

 

find ./ -type f -mtime -일수 -print

find ./ -type f -mtime -일수 -ls

 

find ./ -type f -mtime -일수 -print

find ./ -type f -mtime -일수 -ls | grep "\.c"

1. GOAL

- 1.REST의 개념을 이해한다.

- 2.REST의 특징을 이해한다.

- 3.REST API의 개념을 이해한다.

- 4.REST API의 설계 규칙을 이해한다.

- 5.RESTful의 개념을 이해한다.

 

2. REST란

REST의 정의

“Representational State Transfer” 의 약자

자원을 이름(자원의 표현)으로 구분하여 해당 자원의 상태(정보)를 주고 받는 모든 것을 의미한다.

즉, 자원(resource)의 표현(representation) 에 의한 상태 전달

자원(resource)의 표현(representation)

자원: 해당 소프트웨어가 관리하는 모든 것

-> Ex) 문서, 그림, 데이터, 해당 소프트웨어 자체 등

자원의 표현: 그 자원을 표현하기 위한 이름

-> Ex) DB의 학생 정보가 자원일 때, ‘students’를 자원의 표현으로 정한다.

상태(정보) 전달

데이터가 요청되어지는 시점에서 자원의 상태(정보)를 전달한다.

JSON 혹은 XML를 통해 데이터를 주고 받는 것이 일반적이다.

월드 와이드 웹(www)과 같은 분산 하이퍼미디어 시스템을 위한 소프트웨어 개발 아키텍처의 한 형식

REST는 기본적으로 웹의 기존 기술과 HTTP 프로토콜을 그대로 활용하기 때문에 웹의 장점을 최대한 활용할 수 있는 아키텍처 스타일이다.

REST는 네트워크 상에서 Client와 Server 사이의 통신 방식 중 하나이다.

REST의 구체적인 개념

HTTP URI(Uniform Resource Identifier)를 통해 자원(Resource)을 명시하고, HTTP Method(POST, GET, PUT, DELETE)를 통해 해당 자원에 대한 CRUD Operation을 적용하는 것을 의미한다.

즉, REST는 자원 기반의 구조(ROA, Resource Oriented Architecture) 설계의 중심에 Resource가 있고 HTTP Method를 통해 Resource를 처리하도록 설계된 아키텍쳐를 의미한다.

웹 사이트의 이미지, 텍스트, DB 내용 등의 모든 자원에 고유한 ID인 HTTP URI를 부여한다.

CRUD Operation

Create : 생성(POST)

Read : 조회(GET)

Update : 수정(PUT)

Delete : 삭제(DELETE)

HEAD: header 정보 조회(HEAD)

 

3. REST의 장단점

- 장점

HTTP 프로토콜의 인프라를 그대로 사용하므로 REST API 사용을 위한 별도의 인프라를 구출할 필요가 없다.

HTTP 프로토콜의 표준을 최대한 활용하여 여러 추가적인 장점을 함께 가져갈 수 있게 해준다.

HTTP 표준 프로토콜에 따르는 모든 플랫폼에서 사용이 가능하다.

Hypermedia API의 기본을 충실히 지키면서 범용성을 보장한다.

REST API 메시지가 의도하는 바를 명확하게 나타내므로 의도하는 바를 쉽게 파악할 수 있다.

여러가지 서비스 디자인에서 생길 수 있는 문제를 최소화한다.

서버와 클라이언트의 역할을 명확하게 분리한다.

- 단점

표준이 존재하지 않는다.

사용할 수 있는 메소드가 4가지 밖에 없다.

HTTP Method 형태가 제한적이다.

브라우저를 통해 테스트할 일이 많은 서비스라면 쉽게 고칠 수 있는 URL보다 Header 값이 왠지 더 어렵게 느껴진다.

구형 브라우저가 아직 제대로 지원해주지 못하는 부분이 존재한다.

PUT, DELETE를 사용하지 못하는 점

pushState를 지원하지 않는 점

 

 

4. REST가 필요한 이유

‘애플리케이션 분리 및 통합’

‘다양한 클라이언트의 등장’

최근의 서버 프로그램은 다양한 브라우저와 안드로이폰, 아이폰과 같은 모바일 디바이스에서도 통신을 할 수 있어야 한다.

이러한 멀티 플랫폼에 대한 지원을 위해 서비스 자원에 대한 아키텍처를 세우고 이용하는 방법을 모색한 결과, REST에 관심을 가지게 되었다.

 

5. REST 구성 요소

자원(Resource): URI

모든 자원에 고유한 ID가 존재하고, 이 자원은 Server에 존재한다.

자원을 구별하는 ID는 ‘/groups/:group_id’와 같은 HTTP URI 다.

Client는 URI를 이용해서 자원을 지정하고 해당 자원의 상태(정보)에 대한 조작을 Server에 요청한다.

행위(Verb): HTTP Method

HTTP 프로토콜의 Method를 사용한다.

HTTP 프로토콜은 GET, POST, PUT, DELETE 와 같은 메서드를 제공한다.

표현(Representation of Resource)

Client가 자원의 상태(정보)에 대한 조작을 요청하면 Server는 이에 적절한 응답(Representation)을 보낸다.

REST에서 하나의 자원은 JSON, XML, TEXT, RSS 등 여러 형태의 Representation으로 나타내어 질 수 있다.

JSON 혹은 XML를 통해 데이터를 주고 받는 것이 일반적이다.

 

 

6. REST 특징

Server-Client(서버-클라이언트 구조)

자원이 있는 쪽이 Server, 자원을 요청하는 쪽이 Client가 된다.

REST Server: API를 제공하고 비즈니스 로직 처리 및 저장을 책임진다.

Client: 사용자 인증이나 context(세션, 로그인 정보) 등을 직접 관리하고 책임진다.

서로 간 의존성이 줄어든다.

Stateless(무상태)

HTTP 프로토콜은 Stateless Protocol이므로 REST 역시 무상태성을 갖는다.

Client의 context를 Server에 저장하지 않는다.

즉, 세션과 쿠키와 같은 context 정보를 신경쓰지 않아도 되므로 구현이 단순해진다.

Server는 각각의 요청을 완전히 별개의 것으로 인식하고 처리한다.

각 API 서버는 Client의 요청만을 단순 처리한다.

즉, 이전 요청이 다음 요청의 처리에 연관되어서는 안된다.

물론 이전 요청이 DB를 수정하여 DB에 의해 바뀌는 것은 허용한다.

Server의 처리 방식에 일관성을 부여하고 부담이 줄어들며, 서비스의 자유도가 높아진다.

Cacheable(캐시 처리 가능)

웹 표준 HTTP 프로토콜을 그대로 사용하므로 웹에서 사용하는 기존의 인프라를 그대로 활용할 수 있다.

즉, HTTP가 가진 가장 강력한 특징 중 하나인 캐싱 기능을 적용할 수 있다.

HTTP 프로토콜 표준에서 사용하는 Last-Modified 태그나 E-Tag를 이용하면 캐싱 구현이 가능하다.

대량의 요청을 효율적으로 처리하기 위해 캐시가 요구된다.

캐시 사용을 통해 응답시간이 빨라지고 REST Server 트랜잭션이 발생하지 않기 때문에 전체 응답시간, 성능, 서버의 자원 이용률을 향상시킬 수 있다.

Layered System(계층화)

Client는 REST API Server만 호출한다.

REST Server는 다중 계층으로 구성될 수 있다.

API Server는 순수 비즈니스 로직을 수행하고 그 앞단에 보안, 로드밸런싱, 암호화, 사용자 인증 등을 추가하여 구조상의 유연성을 줄 수 있다.

또한 로드밸런싱, 공유 캐시 등을 통해 확장성과 보안성을 향상시킬 수 있다.

PROXY, 게이트웨이 같은 네트워크 기반의 중간 매체를 사용할 수 있다.

Code-On-Demand(optional)

Server로부터 스크립트를 받아서 Client에서 실행한다.

반드시 충족할 필요는 없다.

Uniform Interface(인터페이스 일관성)

URI로 지정한 Resource에 대한 조작을 통일되고 한정적인 인터페이스로 수행한다.

HTTP 표준 프로토콜에 따르는 모든 플랫폼에서 사용이 가능하다.

특정 언어나 기술에 종속되지 않는다.

 

7. REST API란

API(Application Programming Interface)란

데이터와 기능의 집합을 제공하여 컴퓨터 프로그램간 상호작용을 촉진하며, 서로 정보를 교환가능 하도록 하는 것

REST API의 정의

REST 기반으로 서비스 API를 구현한 것

최근 OpenAPI(누구나 사용할 수 있도록 공개된 API: 구글 맵, 공공 데이터 등), 마이크로 서비스(하나의 큰 애플리케이션을 여러 개의 작은 애플리케이션으로 쪼개어 변경과 조합이 가능하도록 만든 아키텍처) 등을 제공하는 업체 대부분은 REST API를 제공한다.

 

 

8. REST API의 특징

사내 시스템들도 REST 기반으로 시스템을 분산해 확장성과 재사용성을 높여 유지보수 및 운용을 편리하게 할 수 있다.

REST는 HTTP 표준을 기반으로 구현하므로, HTTP를 지원하는 프로그램 언어로 클라이언트, 서버를 구현할 수 있다.

즉, REST API를 제작하면 델파이 클라이언트 뿐 아니라, 자바, C#, 웹 등을 이용해 클라이언트를 제작할 수 있다.

 

 

9. RESTful이란

RESTful은 일반적으로 REST라는 아키텍처를 구현하는 웹 서비스를 나타내기 위해 사용되는 용어이다.

‘REST API’를 제공하는 웹 서비스를 ‘RESTful’하다고 할 수 있다.

RESTful은 REST를 REST답게 쓰기 위한 방법으로, 누군가가 공식적으로 발표한 것이 아니다.

즉, REST 원리를 따르는 시스템은 RESTful이란 용어로 지칭된다.

RESTful의 목적

이해하기 쉽고 사용하기 쉬운 REST API를 만드는 것

RESTful한 API를 구현하는 근본적인 목적이 성능 향상에 있는 것이 아니라 일관적인 컨벤션을 통한 API의 이해도 및 호환성을 높이는 것이 주 동기이니, 성능이 중요한 상황에서는 굳이 RESTful한 API를 구현할 필요는 없다.

RESTful 하지 못한 경우

Ex1) CRUD 기능을 모두 POST로만 처리하는 API

Ex2) route에 resource, id 외의 정보가 들어가는 경우(/students/updateName)

'유용한 자료들(Tip)' 카테고리의 다른 글

Firebase : Send notification with REST API  (0) 2019.10.30

/*

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_send w_send.c -lwsock32 -Wall -DTEST_PRINTF

*/

 

#include  <WinSock2.h>
#include  <windows.h>
#include  <stdio.h>
#include  <stdlib.h>
#include  <string.h>
#include  <time.h>

#define  MAXLINE 4096

DWORD WINAPI stdin_input_send_thread(LPVOID arg);

FILE *fp=NULL;
FILE *stream=NULL;
char line[MAXLINE], chatdata[MAXLINE+1];

struct sockaddr_in server_addr;
SOCKET clientsocket; //server connect socket
char *escape = "quit"; //exit command message
BOOL bisquit;           //exit falg variable

int main(int argc, char *argv[])
{
    WSADATA wsa;    //socket
    HANDLE hthread; //thread
    DWORD threadid;
    int size;

    if (argc != 4) 
    {
        printf("usage : %s server_address port filename\n", argv[0]);
        return(-1);
    }
    bisquit = FALSE;

    //socket initialization
    if (WSAStartup(MAKEWORD(2,2), &wsa) != 0) 
    {
        return(-2);
    }
    //socket creation
    if ((clientsocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) 
    {
        printf("fail make socket\n");
        return(-3);
    }

    //memory initialization
    memset(&server_addr, 0x00, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_addr.s_addr = inet_addr(argv[1]);
    server_addr.sin_port = htons(atoi(argv[2]));

    //connection with server
    if (connect(clientsocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) 
    {
        printf("fail connect to server\n");
        return(-4);
    }

    if((fp = fopen(argv[3], "rt"))==NULL)
    {
        printf("fopen error(%s)\n", argv[3]);
        return(-5);
    }

if((stream = fopen("KRX_SEND.dat", "wt"))==NULL)
    {
        printf("fopen error(%s)\n", argv[3]);
        return(-5);
    }

    hthread = CreateThread(NULL, 0, stdin_input_send_thread, 0, 0, &threadid);
    if (hthread == NULL) 
    {
        printf("fail make thread\n");
    }
    else 
    {
        CloseHandle(hthread);
    }

    while (!bisquit) 
    {
        memset(chatdata, 0x00, sizeof(chatdata));

        if ((size = recv(clientsocket, chatdata, MAXLINE, 0)) == INVALID_SOCKET) 
        {
            break;
        }
        else 
        {
            chatdata[size] = '\0';
            printf("(RECV)%s", chatdata);
fprintf(stream, "%s", chatdata);
        }
    }
    closesocket(clientsocket);
    WSACleanup();

    if(fp != NULL) fclose(fp);
if(stream != NULL) fclose(stream);

    return(0);
}

//user data input mechanism
DWORD WINAPI stdin_input_send_thread(LPVOID arg)
{
    char rbuf[MAXLINE];

    while(TRUE) 
    {
        memset(rbuf, 0x00, sizeof(rbuf));
        if(fgets(rbuf, sizeof(rbuf), fp) == NULL)
{
bisquit = TRUE;
break;
}

        printf("(SEND)%s", rbuf);

        if (send(clientsocket, rbuf, strlen(rbuf), 0) < 0) 
        {
            return(-2);
        }

        Sleep(50); //#include
    }

closesocket(clientsocket);
    return 0;
}

/*

gcc -o w_server w_server.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_server w_server.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_server w_server.c -lwsock32 -Wall -DTEST_PRINTF

gcc -o w_server w_server.c -lwsock32 -Wall -DTEST_PRINTF

*/

 

#include  <winsock2.h>
#include  <fcntl.h>
#include  <stdio.h>
#include  <stdlib.h>
#include  <string.h>

#define MAXLINE 4096
#define MAX_SOCK 64

#define bzero(b,len) (memset(b,0,len))
#define bcopy(b1,b2,len) (memcpy(b1,b2,len))

char *escapechar = "exit";
char send_calc_msg[MAXLINE+1];

//EXTERN LINK VARIABLE
char input[MAXLINE+1];

int maxfd;
int g_num_chat = 0;
int client_s[MAX_SOCK];

FILE *fp=NULL;


//STATIC LINK
static int getmax(int);
static void removeclient(int);
static int getdottedipaddr(int sd, struct sockaddr_in *addr);

int main(int argc, char *argv[]) 
{
    char rline[MAXLINE+1];
    int ii, kk, recv_len;
    int client_fd, clilen, rc;

    fd_set read_fds;
    WSADATA wsadata;
    SOCKET hservsock;
    SOCKADDR_IN client_addr, server_addr;

    if (argc != 2) {
        printf("usage : %s port\n", argv[0]);
        return(-1);
    }

if((fp=fopen("KRX_RECV.dat", "wt"))==NULL)
{
return(-7);
}

if(WSAStartup(MAKEWORD(2,2), &wsadata) != 0)
    {
        return(-9);
    }

    hservsock=socket(PF_INET, SOCK_STREAM, 0);
    if(hservsock==INVALID_SOCKET)
    {
        return(-8);
    }

    bzero((char *)&server_addr, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
    server_addr.sin_port = htons(atoi(argv[1]));

    if (bind(hservsock, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
        return(-3);
    }
    listen(hservsock, 5); /* backlog = 5 */
    maxfd = hservsock + 1;

for(;;)
    {
        FD_ZERO(&read_fds);
        FD_SET(hservsock, &read_fds);
        for (ii=0; ii < g_num_chat; ii++)
        {
            FD_SET(client_s[ii], &read_fds);
        }
        maxfd = getmax(hservsock) + 1;

        if (select(maxfd, &read_fds, (fd_set *)0, (fd_set *)0, (struct timeval *)0) < 0) 
        {
            printf("server: select error.\n");
            break;
        }

        if (FD_ISSET(hservsock, &read_fds)) 
        {
            clilen = sizeof(client_addr);
            client_fd = accept(hservsock, (struct sockaddr *)&client_addr, &clilen);
            if (client_fd == -1) 
            {
                printf("server: accept error\n");
                break;
            }
            client_s[g_num_chat] = client_fd;
            g_num_chat++;
        }

        for (ii=0; ii<g_num_chat; ii++) 
        {
            if (FD_ISSET(client_s[ii], &read_fds)) 
            {
                if ((recv_len = recv(client_s[ii], rline, MAXLINE, 0)) <= 0) 
                {
                    removeclient(ii); /* abrupt exit *//* abrupt exit *//* abrupt exit *//* abrupt exit */
                    continue;
                }
                rline[recv_len] = '\0';

                for (kk=0; kk<g_num_chat; kk++)
                {
                    send(client_s[kk], rline, recv_len, 0);
                    printf("[%.5d][%d]%s", kk, client_s[ii], rline);

                    if(client_s[ii] == client_s[kk])
                    {
                        fprintf(fp,"%s", rline);
                        fflush(fp);  /*in server, very important*/
                     }
                }
            }
        }
    } /* while */

    rc = WSACleanup();
    if(rc == WSANOTINITIALISED)
    {
        printf(">>error::A successful WSAStartup call must occur before using this function.\n");
    }
    else if(rc == WSAENETDOWN)
    {
        printf(">>error::The network subsystem has failed.\n");
    }
    else if(rc == WSAEINPROGRESS)
    {
        printf(">>error::A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.\n");
    }
    closesocket(hservsock);

if(fp != NULL) fclose(fp);
}

void removeclient(int indx) 
{
    struct sockaddr_in client_addr;

    if (getdottedipaddr(client_s[indx], &client_addr) > -1)
    {
        printf("\nserver>>removeclient>>1 number expired!!(IP: %s).", inet_ntoa(client_addr.sin_addr));
    }
    else
    {
        printf("\nserver>>removeclient>>1 number expired!!.");
    }

    closesocket(client_s[indx]);

    if (indx != g_num_chat-1)
    {
        client_s[indx] = client_s[g_num_chat-1];
    }

    g_num_chat--;
    printf("\nserver>>removeclient>>now number = %d\n", g_num_chat);
}

int getmax(int k) 
{
    int max = k;
    int r;

    for (r=0; r < g_num_chat; r++)
    {
        if (client_s[r] > max) max = client_s[r];
    }
    return max;
}

int getdottedipaddr(int sd, struct sockaddr_in *addr) 
{
    struct sockaddr_in client_addr;
    int len, r;

    len = sizeof(client_addr);
    if ((r = getpeername(sd, (struct sockaddr *)&client_addr, &len)) == 0)
    {
        *addr = client_addr;
    }
    return r;
}

 

/*

WINDOWS,SERVER,SELECT(RECV),BASIC(SEND)

*/

 

#include  <winsock2.h>
#include  <stdio.h>
#include  <fcntl.h>
#include  <stdlib.h>
#include  <string.h>

#define MAXLINE 4096
#define MAX_SOCK 64

#define bzero(b,len) (memset(b,0,len))
#define bcopy(b1,b2,len) (memcpy(b1,b2,len))

char *escapechar = "exit";
char send_calc_msg[MAXLINE+1];

//EXTERN LINK VARIABLE
char input[MAXLINE+1];

int maxfd;
int g_num_chat = 0;
int client_s[MAX_SOCK];


//STATIC LINK
static int getmax(int);
static void removeclient(int);
static int getdottedipaddr(int sd, struct sockaddr_in *addr);

int main(int argc, char *argv[]) 
{
    char rline[MAXLINE+1];
    int ii, kk, nn;
    int client_fd, clilen, rc;

    fd_set read_fds;
    WSADATA wsadata;
    SOCKET hservsock;
    SOCKADDR_IN client_addr, server_addr;

    if (argc != 2) {
        printf("usage : %s port\n", argv[0]);
        return(-1);
    }

if(WSAStartup(MAKEWORD(2,2), &wsadata) != 0)
    {
        return(-9);
    }

    hservsock=socket(PF_INET, SOCK_STREAM, 0);
    if(hservsock==INVALID_SOCKET)
    {
        return(-8);
    }

    bzero((char *)&server_addr, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
    server_addr.sin_port = htons(atoi(argv[1]));

    if (bind(hservsock, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
        return(-3);
    }
    listen(hservsock, 5); /* backlog = 5 */
    maxfd = hservsock + 1;

for(;;)
    {
        FD_ZERO(&read_fds);
        FD_SET(hservsock, &read_fds);
        for (ii=0; ii < g_num_chat; ii++)
        {
            FD_SET(client_s[ii], &read_fds);
        }
        maxfd = getmax(hservsock) + 1;

        if (select(maxfd, &read_fds, (fd_set *)0, (fd_set *)0, (struct timeval *)0) < 0) 
        {
            printf("server: select error.\n");
            break;
        }

        if (FD_ISSET(hservsock, &read_fds)) 
        {
            clilen = sizeof(client_addr);
            client_fd = accept(hservsock, (struct sockaddr *)&client_addr, &clilen);
            if (client_fd == -1) 
            {
                printf("server: accept error\n");
                break;
            }
            client_s[g_num_chat] = client_fd;
            g_num_chat++;
        }

        for (ii=0; ii<g_num_chat; ii++) 
        {
            if (FD_ISSET(client_s[ii], &read_fds)) 
            {
                if ((nn = recv(client_s[ii], rline, MAXLINE, 0)) <= 0) 
                {
                    removeclient(ii); /* abrupt exit *//* abrupt exit *//* abrupt exit *//* abrupt exit */
                    continue;
                }
                rline[nn] = 0x00;

                for (kk=0; kk<g_num_chat; kk++)
                {
                    send(client_s[kk], rline, nn, 0);
                    printf("[%.5d][%d]%s", kk, client_s[ii], rline);
                }
            }
        }
    } /* while */

    rc = WSACleanup();
    if(rc == WSANOTINITIALISED)
    {
        printf(">>error::A successful WSAStartup call must occur before using this function.\n");
    }
    else if(rc == WSAENETDOWN)
    {
        printf(">>error::The network subsystem has failed.\n");
    }
    else if(rc == WSAEINPROGRESS)
    {
        printf(">>error::A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.\n");
    }
    closesocket(hservsock);
}

void removeclient(int indx) 
{
    struct sockaddr_in client_addr;

    if (getdottedipaddr(client_s[indx], &client_addr) > -1)
    {
        printf("\nserver>>removeclient>>1 number expired!!(IP: %s).", inet_ntoa(client_addr.sin_addr));
    }
    else
    {
        printf("\nserver>>removeclient>>1 number expired!!.");
    }

    closesocket(client_s[indx]);

    if (indx != g_num_chat-1)
    {
        client_s[indx] = client_s[g_num_chat-1];
    }

    g_num_chat--;
    printf("\nserver>>removeclient>>now number = %d\n", g_num_chat);
}

int getmax(int k) 
{
    int max = k;
    int r;

    for (r=0; r < g_num_chat; r++)
    {
        if (client_s[r] > max) max = client_s[r];
    }
    return max;
}

int getdottedipaddr(int sd, struct sockaddr_in *addr) 
{
    struct sockaddr_in client_addr;
    int len, r;

    len = sizeof(client_addr);
    if ((r = getpeername(sd, (struct sockaddr *)&client_addr, &len)) == 0)
    {
        *addr = client_addr;
    }
    return r;
}

 

/*

WINDOWS,CLIENT,THREAD(FILE READ SEND),BASIC(RECV)

*/

 

#include  <WinSock2.h>
#include  <windows.h>
#include  <stdio.h>
#include  <stdlib.h>
#include  <string.h>

#define  MAXLINE 1024

DWORD WINAPI stdin_input_send_thread(LPVOID arg);

FILE *fp=NULL;
char line[MAXLINE], chatdata[MAXLINE+1];

struct sockaddr_in server_addr;
SOCKET clientsocket; //server connect socket
char *escape = "quit"; //exit command message
BOOL bisquit;           //exit falg variable

int main(int argc, char *argv[])
{
    WSADATA wsa;    //socket
    HANDLE hthread; //thread
    DWORD threadid;
    int size;

    if (argc != 4) 
    {
        printf("usage : %s server_address port filename\n", argv[0]);
        return(-1);
    }
    bisquit = FALSE;

    //socket initialization
    if (WSAStartup(MAKEWORD(2,2), &wsa) != 0) 
    {
        return(-2);
    }
    //socket creation
    if ((clientsocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) 
    {
        printf("fail make socket\n");
        return(-3);
    }

    //memory initialization
    memset(&server_addr, 0x00, sizeof(server_addr));
    server_addr.sin_family = AF_INET;
    server_addr.sin_addr.s_addr = inet_addr(argv[1]);
    server_addr.sin_port = htons(atoi(argv[2]));

    //connection with server
    if (connect(clientsocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) 
    {
        printf("fail connect to server\n");
        return(-4);
    }

    if((fp = fopen(argv[3], "rt"))==NULL)
    {
        printf("fopen error(%s)\n", argv[3]);
        return(-5);
    }

    hthread = CreateThread(NULL, 0, stdin_input_send_thread, 0, 0, &threadid);
    if (hthread == NULL) 
    {
        printf("fail make thread\n");
    }
    else 
    {
        CloseHandle(hthread);
    }

    while (!bisquit) 
    {
        memset(chatdata, 0x00, sizeof(chatdata));

        if ((size = recv(clientsocket, chatdata, MAXLINE, 0)) == INVALID_SOCKET) 
        {
            break;
        }
        else 
        {
            chatdata[size] = '\0';
            printf("(RECV)%s", chatdata);
        }
    }
    closesocket(clientsocket);
    WSACleanup();

    if(fp != NULL) fclose(fp);

    return(0);
}

//user data input mechanism
DWORD WINAPI stdin_input_send_thread(LPVOID arg)
{
    char rbuf[4096];

    while(TRUE) 
    {
        memset(rbuf, 0x00, sizeof(rbuf));
        if(fgets(rbuf, sizeof(rbuf), fp) == NULL) break;

        printf("(SEND)%s", rbuf);

        if (send(clientsocket, rbuf, strlen(rbuf), 0) < 0) 
        {
            return(-2);
        }

        Sleep(500); //#include
    }
    return 0;
}

/*-------------------

 * static 키워드를 사용한 변수는 클래스가 메모리에 올라갈 때 자동으로 생성이 됩니다. 
인스턴스 생성 없이 바로 사용이 가능한 것이죠. 
이런 특성 때문에 프로그램 내에서 공통으로 사용되는 데이터들을 관리할 때 이용합니다. 
자바 프로그램에서는 공통 로직이 들어가는 유틸 기능을 static 으로 작성하곤 합니다. 
이런 static 은 남발해서는 안되며 공통으로 값을 유지하고 싶을 때만 사용합니다.

*/

 

public class StaticSample02 {
    public static void main(String args[]) {

        Card c1 = new Card();
        c1.kind = "Heart";
        c1.number = 7;

        System.out.println("==> 인스턴스 함수 호출");
        System.out.println("totalWidth() : " + c1.totalWidth());

        System.out.println("==> static 함수 호출 ");
        System.out.println("totalWidth() : " + Card.totalWidth(10, 20));
    }
}

 

class Card {

    String kind;      // 카드 종류
    int number;       // 카드 숫자
    int width = 10;   // 카드 넓이
    int height =  25; // 카드 높이

    public int getNumber() {
        return number;
    }
    public int totalWidth() {
        return width * height;
    }
    public static int totalWidth(int width, int height) {
        return width * height;
    }
}

 

/*--------결과 
==> 인스턴스 함수 호출
totalWidth() : 250
==> static 함수 호출 
totalWidth() : 200 

--------------------------------------*/


import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class AES128 {


 public static String key = "AAAAAAAAAAAAAAAA";
 
     public static void main(String[] args) {
         String message = "ABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTU";
  
         AES128 aes128 = new AES128();
  
         try 
         { 
            String encrypt = aes128.encrypt(message);
            System.out.println("[ORIGIN  STR ]= " + message);
            System.out.println("[ENCRYPT STR ]= " + encrypt);
           
            String decrypt = aes128.decrypt(encrypt);
            System.out.println("[DECRYPT STR ]= " + decrypt);
         } 
         catch (Exception e) 
         {
            e.printStackTrace();
         }
     }
     public byte[] hexToByteArray(String hex) {
        if (hex == null || hex.length() == 0) {
            return null;
        }

        byte[] ba = new byte[hex.length() / 2];
        
        for (int i = 0; i < ba.length; i++) {
            ba[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16);
        }
        
        return ba;
     }
     public String byteArrayToHex(byte[] ba) {
        if (ba == null || ba.length == 0) {
            return null;
        }

        StringBuffer sb = new StringBuffer(ba.length * 2);
        String hexNumber;
        
        for (int x = 0; x < ba.length; x++) {
            hexNumber = "0" + Integer.toHexString(0xff & ba[x]);
            sb.append(hexNumber.substring(hexNumber.length() - 2));
        }
        
        return sb.toString();
     }
     public String encrypt(String message) throws Exception {
  
        AES128 aes128 = new AES128();
  
        SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES");

        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

        byte[] encrypted = cipher.doFinal(message.getBytes());
        
        return aes128.byteArrayToHex(encrypted);
     }
     public String decrypt(String encrypted) throws Exception {
  
        AES128 aes128 = new AES128();
  
        SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES");

        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(Cipher.DECRYPT_MODE, skeySpec);
        
        byte[] original = cipher.doFinal(aes128.hexToByteArray(encrypted));
      
        String originalString = new String(original);
        
        return originalString;
    }
}

 

/*결과

[ORIGIN  STR ]= ABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTU
[ENCRYPT STR ]= 1eb6a5b8559de7cf7936ad108fb1bd2cd323454cfb4097b6bc53e670a51e9067
deaeebd8095ae5a76ebf9797c551bc0ab0ebca77dc7be9dd95452b34e90f845c
[DECRYPT STR ]= ABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTUABCDEFGHIJKLMNOPQRSTU

*/​ 

/*

카카오 신입공채 1차 코딩테스트 문제1 비밀지도

 

문제설명

네오는 평소 프로도가 비상금을 숨겨놓는 장소를 알려줄 비밀지도를 손에 넣었다. 그런데 이 비밀지도는 숫자로 암호화되어 있어 위치를 확인하기 위해서는 암호를 해독해야 한다. 다행히 지도 암호를 해독할 방법을 적어놓은 메모도 함께 발견했다.

 

지도는 한 변의 길이가 n인 정사각형 배열 형태로, 각 칸은 “공백”(“ “) 또는 “벽”(“#”) 두 종류로 이루어져 있다.

전체 지도는 두 장의 지도를 겹쳐서 얻을 수 있다. 각각 “지도 1”과 “지도 2”라고 하자. 지도 1 또는 지도 2 중 어느 하나라도 벽인 부분은 전체 지도에서도 벽이다. 지도 1과 지도 2에서 모두 공백인 부분은 전체 지도에서도 공백이다.

“지도 1”과 “지도 2”는 각각 정수 배열로 암호화되어 있다.

암호화된 배열은 지도의 각 가로줄에서 벽 부분을 1, 공백 부분을 0으로 부호화했을 때 얻어지는 이진수에 해당하는 값의 배열이다.

 

이해이미지)

 

 

네오가 프로도의 비상금을 손에 넣을 수 있도록, 비밀지도의 암호를 해독하는 작업을 도와줄 프로그램을 작성하라.

 

입력형식

입력으로 지도의 한 변 크기 n 과 2개의 정수 배열 arr1, arr2가 들어온다.

arr1, arr2는 길이 n인 정수 배열로 주어진다.

정수 배열의 각 원소 x를 이진수로 변환했을 때의 길이는 n 이하이다. 즉, 0 ? x ? 2^n - 1을 만족한다.

 

출력형식

원래의 비밀지도를 해독하여 "#", 공백으로 구성된 문자열 배열로 출력하라.

 

문제해설

이 문제는 비트 연산Bitwise Operation을 묻는 문제입니다. 이미 문제 예시에 2진수로 처리하는 힌트가 포함되어 있고, 둘 중 하나가 1일 경우에 벽 #이 생기기 때문에 OR로 처리하면 간단히 풀 수 있습니다. 아주 쉬운 문제였던 만큼 if else로 풀이한 분들도 많이 발견되었는데요. 정답으로는 간주되지만 이 문제는 비트 연산을 잘 다룰 수 있는지를 묻고자 하는 의도였던 만큼 앞으로 이런 유형의 문제를 풀 때는 비트 연산을 꼭 기억하시기 바랍니다.

 

이 문제의 정답률은 81.78%입니다. 첫 번째 문제이고 가장 쉬운 문제였던 만큼 많은 분들이 잘 풀어주셨습니다.

*/

 

public class SecretMap {

 

    public static void main(String[] args) {

        int[] arr1;

        int[] arr2;

        

        arr1 = new int[]{9, 20, 28, 18, 11};

        arr2 = new int[]{30, 1, 21, 17, 28};

        printArr(decodeSecretMap(5, arr1, arr2));

        

        arr1 = new int[]{46, 33, 33 ,22, 31, 50};

        arr2 = new int[]{27 ,56, 19, 14, 14, 10};

        printArr(decodeSecretMap(6, arr1, arr2));

    }

    

    /**

     * 입력받은 arr1, arr2의 각 int를 or연산 처리 

     * -> toBinaryString으로 변환 -> 출력형태에 맞게 문자열 replace

     * @param n

     * @param arr1

     * @param arr2

     * @return

     */

    public static String[] decodeSecretMap(int n, int[] arr1, int[] arr2) {

        String[] retArr = new String[n];

        for(int i = 0; i < n; i++) {

            retArr[i] = Integer.toBinaryString(arr1[i]|arr2[i]).replace("0", " ").replace("1", "#").replace("2", "$").replace("3", "%");

        }

        return retArr;

    }

    

    /**

     * 배열을 입력받아 println

     * @param arr

     */

    public static void printArr(String[] arr) {

        StringBuilder sb = new StringBuilder();

        for(String str: arr) {

            sb.append(", \""+str+"\"");

        }

        System.out.println(sb.toString().replaceFirst(", ", ""));

    }

}

 

/*결과

bash-3.1$

bash-3.1$ java SecretMap

"#####", "# # #", "### #", "#  ##", "#####"

"######", "###  #", "##  ##", "#### ", "#####", "### # "

bash-3.1$

*/

//IPC QUEUE 데이타를 읽어 KAFKA에 전송하는경우

//FILE의 데이타를 읽어서 KAFKA에 전송하는경우(아래소스는 여기에 해당)

/*

* librdkafka - Apache Kafka C library

*

* Copyright (c) 2017, Magnus Edenhill

* All rights reserved.

*

* Redistribution and use in source and binary forms, with or without

* modification, are permitted provided that the following conditions are met:

*

* 1. Redistributions of source code must retain the above copyright notice,

*    this list of conditions and the following disclaimer.

* 2. Redistributions in binary form must reproduce the above copyright notice,

*    this list of conditions and the following disclaimer in the documentation

*    and/or other materials provided with the distribution.

*

* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE

* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR

* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)

* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE

* POSSIBILITY OF SUCH DAMAGE.

*/

 

/**

* Simple Apache Kafka producer

* using the Kafka driver from librdkafka

* (https://github.com/edenhill/librdkafka)

*/

 

#include <stdio.h>

#include <signal.h>

#include <string.h>

 

 

/* Typical include path would be <librdkafka/rdkafka.h>, but this program

* is builtin from within the librdkafka source tree and thus differs. */

#include "rdkafka.h"

 

static int run = 1;

 

/**

* @brief Signal termination of program

*/

static void stop (int sig) {

    run = 0;

    fclose(stdin); /* abort fgets() */

}

 

 

/**

* @brief Message delivery report callback.

*

* This callback is called exactly once per message, indicating if

* the message was succesfully delivered

* (rkmessage->err == RD_KAFKA_RESP_ERR_NO_ERROR) or permanently

* failed delivery (rkmessage->err != RD_KAFKA_RESP_ERR_NO_ERROR).

*

* The callback is triggered from rd_kafka_poll() and executes on

* the application's thread.

*/

static void dr_msg_cb (rd_kafka_t *rk, const rd_kafka_message_t *rkmessage, void *opaque) {

    if (rkmessage->err)

        fprintf(stderr, "%% Message delivery failed: %s\n",

        rd_kafka_err2str(rkmessage->err));

    else

        fprintf(stderr,"%% Message delivered (%zd bytes, ""partition %"PRId32")\n",rkmessage->len, rkmessage->partition);

    /* The rkmessage is destroyed automatically by librdkafka */

}

 

int main (int argc, char **argv) {

    rd_kafka_t *rk;         /* Producer instance handle */

    rd_kafka_topic_t *rkt;  /* Topic object */

    rd_kafka_conf_t *conf;  /* Temporary configuration object */

    char errstr[512];       /* librdkafka API error reporting buffer */

    char buf[512];          /* Message value temporary buffer */

    const char *brokers;    /* Argument: broker list */

    const char *topic;      /* Argument: topic to produce to */

 

    FILE *fp=NULL;

 

    /*

     * Argument validation

     */

    if (argc != 4) {

        fprintf(stderr, "%% Usage: %s <broker> <topic> <filename>\n", argv[0]);

        return -1;

    }

 

    brokers = argv[1];   //127.0.0.1:9092

 

    //1.1 기본적인 topic 생성예제(topic의 이름은 test)

    //>bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

    //1.2 일자별로 topic생성(아래예제는 20180401 ~ 20180431, 4월 날짜별로 topic생성)

    //>for ii in `seq 20180401 20180431`; do bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic $ii; done

 

    //3. Step 3: Create a topic

    //3.1 Let's create a topic named "test" with a single partition and only one replica:

    // for ii in `seq 20180411 20180431`; do bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic $ii; done

    //> cd /home1/irteamsu/kafka2/kafka_2.11-1.1.0

    //> bin/kafka-server-start.sh config/server.properties

    //3.2 TOPIC리스트 확인

    //> bin/kafka-topics.sh --list --zookeeper localhost:2181

    

    topic   = argv[2];   //YYYYMMDD

 

    if((fp=fopen(argv[3], "rt"))==NULL) return(-1);

    /*

     * Create Kafka client configuration place-holder

     */

    conf = rd_kafka_conf_new();

 

    /* Set bootstrap broker(s) as a comma-separated list of

     * host or host:port (default port 9092).

     * librdkafka will use the bootstrap brokers to acquire the full

     * set of brokers from the cluster. */

    if (rd_kafka_conf_set(conf, "bootstrap.servers", brokers,errstr, sizeof(errstr)) != RD_KAFKA_CONF_OK) 

    {

        fprintf(stderr, "%s\n", errstr);

        return -1;

    }

 

    /* Set the delivery report callback.

     * This callback will be called once per message to inform

     * the application if delivery succeeded or failed.

     * See dr_msg_cb() above. */

    rd_kafka_conf_set_dr_msg_cb(conf, dr_msg_cb);

 

 

    /*

     * Create producer instance.

     *

     * NOTE: rd_kafka_new() takes ownership of the conf object

     *       and the application must not reference it again after

     *       this call.

     */

    rk = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errstr, sizeof(errstr));

    if (!rk) {

        fprintf(stderr,

            "%% Failed to create new producer: %s\n", errstr);

        return -1;

    }

 

 

    /* Create topic object that will be reused for each message

     * produced.

     *

     * Both the producer instance (rd_kafka_t) and topic objects (topic_t)

     * are long-lived objects that should be reused as much as possible.

     */

    rkt = rd_kafka_topic_new(rk, topic, NULL);

    if (!rkt) {

        fprintf(stderr, "%% Failed to create topic object: %s\n",

        rd_kafka_err2str(rd_kafka_last_error()));

        rd_kafka_destroy(rk);

        return -1;

    }

 

    /* Signal handler for clean shutdown */

    signal(SIGINT, stop);

 

    fprintf(stderr,

        "%% Type some text and hit enter to produce message\n"

        "%% Or just hit enter to only serve delivery reports\n"

        "%% Press Ctrl-C or Ctrl-D to exit\n");

 

    while (run) 

    {

        memset(buf, 0x00, sizeof(buf));

        if(fgets(buf, sizeof(buf), fp)==NULL) break;

 

        size_t len = strlen(buf);

 

        if (buf[len-1] == '\n') /* Remove newline */

        buf[--len] = '\0';

 

        if (len == 0) {

            /* Empty line: only serve delivery reports */

            rd_kafka_poll(rk, 0/*non-blocking */);

            continue;

        }

 

    /*

     * Send/Produce message.

     * This is an asynchronous call, on success it will only

     * enqueue the message on the internal producer queue.

     * The actual delivery attempts to the broker are handled

     * by background threads.

     * The previously registered delivery report callback

     * (dr_msg_cb) is used to signal back to the application

     * when the message has been delivered (or failed).

     */

    retry:

        if (rd_kafka_produce(

            /* Topic object */

            rkt,

            /* Use builtin partitioner to select partition*/

            RD_KAFKA_PARTITION_UA,

            /* Make a copy of the payload. */

            RD_KAFKA_MSG_F_COPY,

            /* Message payload (value) and length */

            buf, len,

            /* Optional key and its length */

            NULL, 0,

            /* Message opaque, provided in

             * delivery report callback as

             * msg_opaque. */

            NULL) == -1)

        {

            /**

             * Failed to *enqueue* message for producing.

             */

            fprintf(stderr,

            "%% Failed to produce to topic %s: %s\n",

            rd_kafka_topic_name(rkt),

            rd_kafka_err2str(rd_kafka_last_error()));

 

            /* Poll to handle delivery reports */

            if (rd_kafka_last_error() ==

                RD_KAFKA_RESP_ERR__QUEUE_FULL) {

                /* If the internal queue is full, wait for

                 * messages to be delivered and then retry.

                 * The internal queue represents both

                 * messages to be sent and messages that have

                 * been sent or failed, awaiting their

                 * delivery report callback to be called.

                 *

                 * The internal queue is limited by the

                 * configuration property

                 * queue.buffering.max.messages */

                rd_kafka_poll(rk, 1000/*block for max 1000ms*/);

                goto retry;

            }

        

        else 

        {

            fprintf(stderr, "%% Enqueued message (%zd bytes) "

                "for topic %s\n",

                len, rd_kafka_topic_name(rkt));

        }

 

 

        /* A producer application should continually serve

         * the delivery report queue by calling rd_kafka_poll()

         * at frequent intervals.

         * Either put the poll call in your main loop, or in a

         * dedicated thread, or call it after every

         * rd_kafka_produce() call.

         * Just make sure that rd_kafka_poll() is still called

         * during periods where you are not producing any messages

         * to make sure previously produced messages have their

         * delivery report callback served (and any other callbacks

         * you register). */

        rd_kafka_poll(rk, 0/*non-blocking*/);

    }

 

    /* Wait for final messages to be delivered or fail.

     * rd_kafka_flush() is an abstraction over rd_kafka_poll() which

     * waits for all messages to be delivered. 

     */

    fprintf(stderr, "%% Flushing final messages..\n");

    rd_kafka_flush(rk, 10*1000 /* wait for max 10 seconds */);

 

    /* Destroy topic object */

    rd_kafka_topic_destroy(rkt);

 

    /* Destroy the producer instance */

    rd_kafka_destroy(rk);

 

    return 0;

}

 

 

'통신 > THREAD(TCP)' 카테고리의 다른 글

RcvManualData.c  (0) 2021.03.17

+ Recent posts