리틀-엔디안 (Little-Endian)

낮은(시작) 주소에 하위 바이트부터 기록, Intel CPU 계열

예) 32비트형 (4바이트) 값: 0x01020304

하위 주소 0x04 0x03 0x02 0x01 상위 주소

 

 

빅-엔디안 (Big-Endian)

낮은(시작) 주소에 상위 바이트부터 기록, Sparc / RISC CPU 계열

예) 32비트형 (4바이트) 값: 0x01020304

하위 주소 0x01 0x02 0x03 0x04 상위 주소

 

 

빅엔디안은 우리가 평소에 보던 방식으로 메모리에 쓴다고 생각하면 되고 리틀엔디안은 뒤집혀서 쓴다고 이해하면 되겠죠? 

 

그럼 왜 빅엔디안으로 안 쓰는 걸까요? 

 

그 이유는 산술연산유닛(ALU)에서 메모리를 읽는 방식이 메모리 주소가 낮은 쪽에서부터 높은 쪽으로 읽기 때문에 

산술 연산의 수행이 더 쉽습니다. 또한, 데이터를 다른 시스템으로 전송할 때 

서로 다른 데이터 저장 방식의 시스템끼리 통신하게 되면 전혀 엉뚱한 값을 주고받기 때문이랍니다.

 

자바스크립트의 DataView 인터페이스는 특정 파일 또는 수신된 바이너리 데이터를 읽고 쓸 수 있도록 설계되었습니다. 

브라우저가 작동 중인 CPU에 상관 없이 일관되고 올바른 결과를 얻을 수 있도록 작동하기 위해 

모든 값의 모든 접근에 엔디안(Endianness)을 지정해야 합니다.

 

-----------------------------------------------------------------------------------------

long a = 0x1234;

a = htonl(a);

 

호출전: 0x0012FED4  34 12 00 00

호출후: 0x0012FED4  00 00 12 34

-----------------------------------------------------------------------------------------

 

다음과 같은 간단한 코드를 이용해서 시스템의 Endian 을 체크할수 있다.

 

void main(void)

{

    int i = 0x00000001;

 

    if( ((char *)&i)[0] )

        printf( "Littile Endian\n" );

    else

        printf( "Big Endian\n" );

 

    /* ANOTHER */

if( *((char *)&i+0) )

        printf( "Littile Endian\n" );

    else

        printf( "Big Endian\n" );

}

/**
BUILD & MAKE(WINDOW & LINUX COMMON)
-------------------------------------------------------------------
CC = gcc

CFLAGS += -I -g -Wall -Wno-unused-variable
LIBS += -L. -lcurl -ljson-c

.c.o:
$(CC) -c $< $(CFLAGS)

all: build

common.o : common.c
pushcall.o : pushcall.c

pushcall: pushcall.o common.o
$(CC) -o $@ $^ $(LIBS)
BUILD_FILES += pushcall

build: $(BUILD_FILES)

clean:
rm -f *.o
rm -f $(BUILD_FILES)
-------------------------------------------------------------------
*/
#include 
#include 

#include <curl/curl.h>
#include 
#include 
#include 
#include <sys/time.h>
#include "json.h"

#define MAX_MSG_CNT 14
#define authorization_str "AUTHORIZATION:"
#define token_str "TOKEN:"

/* holder for curl fetch */
struct curl_fetch_st {
    char *payload;
    size_t size;
};

static json_object *google_pushcall(char *authorization, char *title, char *body, char *token);
static size_t curl_callback (void *contents, size_t size, size_t nmemb, void *userp);
static CURLcode curl_fetch_url(CURL *ch, const char *url, struct curl_fetch_st *fetch);
static int jsonparsing_result(const char *buf);
static int get_config_values(char *authorization, char *token);

int GetDate();
int GetTime();

int get_config_values(char *authorization, char *token)
{
FILE *fp=NULL;
char rbuf[1024];

if((fp=fopen("config.txt", "rt"))==NULL) return(-1);

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

rbuf[strlen(rbuf)-1]=0x00;

if(rbuf[0] == '#') continue;

if(strstr(rbuf, authorization_str) != NULL)
{
strcpy(authorization, strstr(rbuf, authorization_str) + strlen(authorization_str));
}
if(strstr(rbuf, token_str) != NULL)
{
strcpy(token, strstr(rbuf, token_str) + strlen(token_str));
}
}
if(fp != NULL) fclose(fp);
return(0);
}

int main(int argc, char *argv[])
{
json_object *json = NULL;
int rc;

char authorization[1024];
char token[300];

char *title = "FCM Message";
char body[4096];
char extendedmsg[MAX_MSG_CNT][300] = 
{
"Miracles happen to only those who believe in them.",
"Think like a man of action and act like man of thought.",
"Courage is very important. Like a muscle, it is strengthened by use.",
"Life is the art of drawing sufficient conclusions from insufficient premises.",
"By doubting we come at the truth.",
"A man that has no virtue in himself, ever envies virtue in others.",
"When money speaks, the truth keeps silent.",
"Better the last smile than the first laughter.",
"Painless poverty is better than embittered wealth.",
"A poet is the painter of the soul.",
"Error is the discipline through which we advance.",
"Faith without deeds is useless.",
"Weak things united become strong.",
"We give advice, but we cannot give conduct.",
};

    memset(authorization,0x00,sizeof(authorization));
memset(token,0x00,sizeof(token));

rc=get_config_values(authorization, token);
if(rc)
{
//ERROR
}
else
{
fprintf(stderr, "authorization:(%s)\n", authorization);
fprintf(stderr, "token:        (%s)\n", token);
}

    memset(body,0x00,sizeof(body));
sprintf(body, "Body>>(%d-%d)(%d)(%s)", GetDate(), GetTime(), GetTime() % MAX_MSG_CNT, extendedmsg[GetTime() % MAX_MSG_CNT]);

json = google_pushcall(authorization, title, body, token);
if(json == NULL) {
return(-1);
}

/* debugging */
    fprintf(stderr, "RECV>>Parsed JSON: %s\n", json_object_to_json_string(json));

rc = jsonparsing_result(json_object_to_json_string(json));
if(rc)
{
//error
}
else
{
//INSERT PUSH_SIT_EVENT_HIST
}

if(json != NULL) json_object_put(json);

return(0);
}

/* callback for curl fetch */
size_t curl_callback (void *contents, size_t size, size_t nmemb, void *userp) {
    size_t realsize = size * nmemb;                             /* calculate buffer size */
    struct curl_fetch_st *p = (struct curl_fetch_st *) userp;   /* cast pointer to fetch struct */

    /* expand buffer */
    p->payload = (char *) realloc(p->payload, p->size + realsize + 1);

    /* check buffer */
    if (p->payload == NULL) {
      /* this isn't good */
      fprintf(stderr, "ERROR: Failed to expand buffer in curl_callback\n");
      /* free buffer */
      free(p->payload);
      /* return */
      return -1;
    }

    /* copy contents to buffer */
    memcpy(&(p->payload[p->size]), contents, realsize);

    /* set new buffer size */
    p->size += realsize;

    /* ensure null termination */
    p->payload[p->size] = 0;

    /* return size */
    return realsize;
}

/* fetch and return url body via curl */
CURLcode curl_fetch_url(CURL *ch, const char *url, struct curl_fetch_st *fetch) {
    CURLcode rcode;                   /* curl result code */

    /* init payload */
    fetch->payload = (char *) calloc(1, sizeof(fetch->payload));

    /* check payload */
    if (fetch->payload == NULL) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to allocate payload in curl_fetch_url\n");
        /* return error */
        return CURLE_FAILED_INIT;
    }

    /* init size */
    fetch->size = 0;

    /* set url to fetch */
    curl_easy_setopt(ch, CURLOPT_URL, url);
    /* set calback function */
    curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, curl_callback);
    /* pass fetch struct pointer */
    curl_easy_setopt(ch, CURLOPT_WRITEDATA, (void *) fetch);
    /* set default user agent */
    //curl_easy_setopt(ch, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_setopt(ch, CURLOPT_USERAGENT, "curl/7.65.1");
    /* set timeout */
    curl_easy_setopt(ch, CURLOPT_TIMEOUT, 30);
    /* enable location redirects */
    curl_easy_setopt(ch, CURLOPT_FOLLOWLOCATION, 1);
    /* set maximum allowed redirects */
    curl_easy_setopt(ch, CURLOPT_MAXREDIRS, 1);
    /* fetch the url */
    rcode = curl_easy_perform(ch);

    /* return */
    return rcode;
}

json_object *google_pushcall(char *authorization, char *title, char *body, char *token)
{
    CURL *ch;                                               /* curl handle */
    CURLcode rcode;                                         /* curl result code */

    json_object *json=NULL;                                 /* json post body */
json_object *jsonobj=NULL;                              /* json post body */

    enum json_tokener_error jerr = json_tokener_success;    /* json parse error */

    struct curl_fetch_st curl_fetch;                        /* curl fetch struct */
    struct curl_fetch_st *cf = &curl_fetch;                 /* pointer to fetch struct */
    struct curl_slist *headers = NULL;                      /* http headers to send with request */

char post_data  [4096] = {0x00,};

char header_definition[2048];

char *url = "https://fcm.googleapis.com/fcm/send";

    /* init curl handle */
    if ((ch = curl_easy_init()) == NULL) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to create curl handle in fetch_session\n");
        /* return error */
        return NULL;
    }

    /* set content type */
memset(header_definition,0x00,sizeof(header_definition));
sprintf(header_definition, "Authorization: key=%s", authorization);
    headers = curl_slist_append(headers, header_definition);
    headers = curl_slist_append(headers, "Content-Type: application/json");

    /* create json object for post */
    json      = json_object_new_object();
jsonobj   = json_object_new_object();

    /* build post data */
    /*-----------------------------------------------------------------------------------
json_object_object_add(jsoninobj, "title"       , json_object_new_string(title));
    json_object_object_add(jsoninobj, "body"        , json_object_new_string(body));
    json_object_object_add(jsonobj  , "notification", jsoninobj);
json_object_object_add(jsonobj  , "token"       , json_object_new_string(token));
json_object_object_add(json     , "message"     , jsonobj);
-----------------------------------------------------------------------------------*/
json_object_object_add(json  ,  "to"          , json_object_new_string(token));
json_object_object_add(jsonobj, "title"       , json_object_new_string(title));
    json_object_object_add(jsonobj, "body"        , json_object_new_string(body));
    json_object_object_add(json  ,  "notification", jsonobj);

memset(post_data, 0x00, sizeof(post_data));
sprintf(post_data, "%s", json_object_to_json_string(json));

#if(1)
/* debugging */
    fprintf(stderr, "SEND>>Parsed JSON: [%s]\n", post_data);
#endif

    /* set curl options */
    curl_easy_setopt(ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(ch, CURLOPT_POSTFIELDS, post_data);
curl_easy_setopt(ch, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(ch, CURLOPT_POST, 1L);
/* disconnect if we can't validate server's cert */ 
    curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L);

    /* fetch page and capture return code */
    rcode = curl_fetch_url(ch, url, cf);

    //FREE
    curl_easy_cleanup(ch);
    curl_slist_free_all(headers);

    if(json != NULL) json_object_put(json);
if(jsonobj != NULL) json_object_put(jsonobj);

    /* check return code */
    if (rcode != CURLE_OK || cf->size < 1) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to fetch url (%s) - curl said: %s\n",
            url, curl_easy_strerror(rcode));
        /* return error */
        return NULL;
    }

    /* check payload */
    if (cf->payload != NULL) {

#if(0)
        /* print result */
        fprintf(stderr, "CURL Returned: [%s]\n", cf->payload);
#endif

        /* parse return */
        json = json_tokener_parse_verbose(cf->payload, &jerr);
        /* free payload */
        free(cf->payload);
    } else {
        /* error */
        fprintf(stderr, "ERROR: Failed to populate payload\n");
        /* free payload */
        free(cf->payload);
        /* return */
        return NULL;
    }

    /* check error */
    if (jerr != json_tokener_success) {
        /* error */
        fprintf(stderr, "ERROR: Failed to parse json string\n");
        /* free json object */
        if(json != NULL) json_object_put(json);
        /* return */
        return NULL;
    }
return json;
}

int jsonparsing_result(const char *buf)
{
int ii, rc;
char keystr[100],successtmp[100];
struct json_object *jsonjob   = NULL;
struct json_object *jsonvalue = NULL;

jsonjob = json_tokener_parse(buf);
if(NULL == jsonjob) {
return -1;
}
printf("\n\n\n\n");

    memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "success");
json_object_object_get_ex(jsonjob, keystr, &jsonvalue);
memset(successtmp, 0x00, sizeof(successtmp));
strcpy(successtmp, json_object_get_string(jsonvalue));

if(atoi(successtmp) == 1 || atoi(successtmp) == 0)
{
if(atoi(successtmp) == 0) printf("[FAIL]BASIC DATA-----------------------------------\n");
if(atoi(successtmp) == 1) printf("[SUCC]BASIC DATA-----------------------------------\n");

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "multicast_id");
json_object_object_get_ex(jsonjob, keystr, &jsonvalue);
printf("[%s][%s]\n", keystr, json_object_get_string(jsonvalue));

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "success");
json_object_object_get_ex(jsonjob, keystr, &jsonvalue);
printf("[%s][%s]\n", keystr, json_object_get_string(jsonvalue));

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "failure");
json_object_object_get_ex(jsonjob, keystr, &jsonvalue);
printf("[%s][%s]\n", keystr, json_object_get_string(jsonvalue));

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "canonical_ids");
json_object_object_get_ex(jsonjob, keystr, &jsonvalue);
printf("[%s][%s]\n", keystr, json_object_get_string(jsonvalue));

struct json_object *pdata = NULL;
if(json_object_object_get_ex(jsonjob, "results", &pdata)) 
{
for (ii = 0; ii < json_object_array_length(pdata); ii++) 
{
if(ii==0)
{
printf("ARRAY DATA[%.4d]-----------------------------------\n", json_object_array_length(pdata));
}

struct json_object *successtmp = json_object_array_get_idx(pdata, ii);

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "message_id");
rc = json_object_object_get_ex(successtmp, keystr, &jsonvalue);
if(rc)
{
printf("rc:[%d]", rc);
printf(",index[%.3d],key[%s]:[%s]\n", ii + 1, keystr, json_object_get_string(jsonvalue));
}

memset(keystr, 0x00, sizeof(keystr));
strcpy(keystr, "error");
rc = json_object_object_get_ex(successtmp, keystr, &jsonvalue);
if(rc)
{
printf("rc:[%d]", rc);
printf(",index[%.3d],key[%s]:[%s]\n", ii + 1, keystr, json_object_get_string(jsonvalue));
}
}
}
}
else
{
return(-2);
}

return(0);
}

/*NEEDED FILES------------------------------------------------------------------------
bash-3.1$ ls -lrt *.c
-rw-r--r-- 1 kiwoom Administrators  7660 Jul 12 10:31 common.c
-rw-r--r-- 1 kiwoom Administrators 12584 Jul 25 10:19 pushcall.c
bash-3.1$ ls -lrt *.h
-rw-r--r-- 1 kiwoom Administrators  1064 Jul  8 08:51 vasprintf_compat.h
-rw-r--r-- 1 kiwoom Administrators   276 Jul  8 08:51 strerror_override_private.h
-rw-r--r-- 1 kiwoom Administrators   510 Jul  8 08:51 strerror_override.h
-rw-r--r-- 1 kiwoom Administrators   367 Jul  8 08:51 strdup_compat.h
-rw-r--r-- 1 kiwoom Administrators   943 Jul  8 08:51 snprintf_compat.h
-rw-r--r-- 1 kiwoom Administrators   506 Jul  8 08:51 random_seed.h
-rw-r--r-- 1 kiwoom Administrators  3858 Jul  8 08:51 printbuf.h
-rw-r--r-- 1 kiwoom Administrators   644 Jul  8 08:51 math_compat.h
-rw-r--r-- 1 kiwoom Administrators 10219 Jul  8 08:51 linkhash.h
-rw-r--r-- 1 kiwoom Administrators  3181 Jul  8 08:51 json_visit.h
-rw-r--r-- 1 kiwoom Administrators  2985 Jul  8 08:51 json_util.h
-rw-r--r-- 1 kiwoom Administrators  7150 Jul  8 08:51 json_tokener.h
-rw-r--r-- 1 kiwoom Administrators  4832 Jul  8 08:51 json_pointer.h
-rw-r--r-- 1 kiwoom Administrators  1499 Jul  8 08:51 json_object_private.h
-rw-r--r-- 1 kiwoom Administrators  8274 Jul  8 08:51 json_object_iterator.h
-rw-r--r-- 1 kiwoom Administrators 38349 Jul  8 08:51 json_object.h
-rw-r--r-- 1 kiwoom Administrators   350 Jul  8 08:51 json_inttypes.h
-rw-r--r-- 1 kiwoom Administrators   143 Jul  8 08:51 json_config.h
-rw-r--r-- 1 kiwoom Administrators  1185 Jul  8 08:51 json_c_version.h
-rw-r--r-- 1 kiwoom Administrators   810 Jul  8 08:51 json.h
-rw-r--r-- 1 kiwoom Administrators  1724 Jul  8 08:51 debug.h
-rw-r--r-- 1 kiwoom Administrators  5761 Jul  8 08:51 config.h
-rw-r--r-- 1 kiwoom Administrators  1554 Jul  8 08:51 arraylist.h
bash-3.1$ ls -lrt *.a
-rw-r--r-- 1 kiwoom Administrators 81888 Jul  8 08:51 libjson-c.a
-rw-r--r-- 1 kiwoom Administrators 51808 Jul  8 08:51 libcurl.dll.a
bash-3.1$ ls -lrt *.dll
-rwxr-xr-x 1 kiwoom Administrators  528896 Jul  8 08:51 libssl-1_1.dll
-rwxr-xr-x 1 kiwoom Administrators  985720 Jul  8 08:51 libcurl.dll
-rwxr-xr-x 1 kiwoom Administrators 2499072 Jul  8 08:51 libcrypto-1_1.dll
-rwxr-xr-x 1 kiwoom Administrators  505344 Jul  8 08:51 brotlienc.dll
-rwxr-xr-x 1 kiwoom Administrators   44032 Jul  8 08:51 brotlidec.dll
-rwxr-xr-x 1 kiwoom Administrators  132096 Jul  8 08:51 brotlicommon.dll
bash-3.1$
-----------------------------------------------------------------------------------*/

/**
 * example C code using libcurl and json-c
 * to post and return a payload using
 * http://jsonplaceholder.typicode.com
 *
 * Requirements:
 *
 * json-c - https://github.com/json-c/json-c
 * libcurl - http://curl.haxx.se/libcurl/c
 *
 * Build:
 *
 * gcc test.c -lcrypto -lcurl -ljson-c -o test

 *

 * DESCRIPTION

   - 특정사이트에 접속해서 데이타를 불러오는역할은 curl lib가 담당한다.

   - 데이타 입력및 출력의 인터페이스에 필요한 데이타의 암호화는 ​lcrypto lib가 담당한다.

   - 출력데이타를 복호화 했을때에, JSON형식의 데이타를 파싱하는데에는 ​ljson-c lib가 필요하다.
 * 
 */

/* standard includes */
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include <curl/curl.h>
#include <iconv.h>
#include <locale.h>
#include <langinfo.h>
#include <openssl/aes.h>
#include <time.h>
#include <sys/time.h>
#include <json-c/json.h>

#define MAX_AES_BUFF_SIZE 2048
#define MAX_FSS_STRING_SIZE 100

 

int __debug;


const unsigned char fw_aes_key[16+1] = {0X45, 0X72, 0X23, 0X33, 0X77, 0XAB, 0X6C, 0X6C, 0XFD, 0X59, 0X6C, 0X75, 0X74, 0X69, 0X6F, 0X6E, 0x00};

 

/* holder for curl fetch */
struct curl_fetch_st {
    char *payload;
    size_t size;
};

 

/*

 * Function prototype

 */
json_object *sbo634_wascall(char *MSGCODE, char *ACCNO, char *PAGE);
size_t curl_callback (void *contents, size_t size, size_t nmemb, void *userp);
CURLcode curl_fetch_url(CURL *ch, const char *url, struct curl_fetch_st *fetch);

static void e_hex_convert(const void* pv, size_t len, char *outBuff) {
    const unsigned char * p = (const unsigned char*)pv;
 
    if (NULL == pv) {
        return;
    }
    else

    {
        size_t i = 0;
        int hexLen = 0;
        char editb[8];


        memset (editb, 0x00, sizeof(editb));
        for (; i<len;++i) {
            sprintf(editb, "%02X", *p++);
            memcpy(outBuff+hexLen, editb, 2);
            hexLen += 2; 
        }
    }
    return;
}

static void d_hex_convert(unsigned char *pv, size_t len, char *outBuff) {
    const unsigned char * p = (const unsigned char*)pv;
 
    int ii, kk, jj;
 
    kk=0;
    ii=0;
    while(1)
    {
        if(ii >= len) break;
  
        jj=0;
        if(pv[ii] == 'F') pv[ii] = 15;
        else if(pv[ii] == 'E') pv[ii] = 14;
        else if(pv[ii] == 'D') pv[ii] = 13;
        else if(pv[ii] == 'C') pv[ii] = 12;
        else if(pv[ii] == 'B') pv[ii] = 11;
        else if(pv[ii] == 'A') pv[ii] = 10;
        else if(pv[ii] == '9') pv[ii] = 9;
        else if(pv[ii] == '8') pv[ii] = 8;
        else if(pv[ii] == '7') pv[ii] = 7;
        else if(pv[ii] == '6') pv[ii] = 6;
        else if(pv[ii] == '5') pv[ii] = 5;
        else if(pv[ii] == '4') pv[ii] = 4;
        else if(pv[ii] == '3') pv[ii] = 3;
        else if(pv[ii] == '2') pv[ii] = 2;
        else if(pv[ii] == '1') pv[ii] = 1;
        else if(pv[ii] == '0') pv[ii] = 0;
  
        if((pv[ii] & 0x08) > 0) jj = jj + 128;
        if((pv[ii] & 0x04) > 0) jj = jj + 64;
        if((pv[ii] & 0x02) > 0) jj = jj + 32;
        if((pv[ii] & 0x01) > 0) jj = jj + 16;
  
        if(pv[ii+1] == 'F') pv[ii+1] = 15;
        else if(pv[ii+1] == 'E') pv[ii+1] = 14;
        else if(pv[ii+1] == 'D') pv[ii+1] = 13;
        else if(pv[ii+1] == 'C') pv[ii+1] = 12;
        else if(pv[ii+1] == 'B') pv[ii+1] = 11;
        else if(pv[ii+1] == 'A') pv[ii+1] = 10;
        else if(pv[ii+1] == '9') pv[ii+1] = 9;
        else if(pv[ii+1] == '8') pv[ii+1] = 8;
        else if(pv[ii+1] == '7') pv[ii+1] = 7;
        else if(pv[ii+1] == '6') pv[ii+1] = 6;
        else if(pv[ii+1] == '5') pv[ii+1] = 5;
        else if(pv[ii+1] == '4') pv[ii+1] = 4;
        else if(pv[ii+1] == '3') pv[ii+1] = 3;
        else if(pv[ii+1] == '2') pv[ii+1] = 2;
        else if(pv[ii+1] == '1') pv[ii+1] = 1;
        else if(pv[ii+1] == '0') pv[ii+1] = 0;
  
        if((pv[ii+1] & 0x08) > 0) jj = jj + 8;
        if((pv[ii+1] & 0x04) > 0) jj = jj + 4;
        if((pv[ii+1] & 0x02) > 0) jj = jj + 2;
        if((pv[ii+1] & 0x01) > 0) jj = jj + 1;
  
        outBuff[kk] = jj;
  
        kk = kk + 1;
        ii = ii + 2;
    }
    return;
}

static int e_makeAesPacket(unsigned char *EncryptText, int EncryptTextLen, unsigned char *DecryptText) {
 
    AES_KEY enc_key;
    long idx=0;
    unsigned char padBuff[MAX_AES_BUFF_SIZE];
    unsigned char encBuff[MAX_AES_BUFF_SIZE];
    int ii;

    size_t encPadLen = ((EncryptTextLen + AES_BLOCK_SIZE) / AES_BLOCK_SIZE) * AES_BLOCK_SIZE;

    memset(padBuff, 0x00, MAX_AES_BUFF_SIZE);
    memset(encBuff, 0x00, MAX_AES_BUFF_SIZE);
 
    AES_set_encrypt_key(fw_aes_key, 128, &enc_key);

    memcpy(padBuff, EncryptText, EncryptTextLen);
    for (ii = EncryptTextLen; ii < encPadLen; ii++) {
        padBuff[ii] = (encPadLen - EncryptTextLen);
    }

    while(idx < encPadLen) {
        AES_ecb_encrypt(padBuff+idx, encBuff+idx, &enc_key, AES_ENCRYPT);
        idx += AES_BLOCK_SIZE;
    }
 
    printf("e_makeAesPacket[%d]", strlen(encBuff));

    e_hex_convert(encBuff, encPadLen, DecryptText);

    return(strlen(DecryptText));
}

static int d_makeAesPacket(unsigned char *DecryptText, int DecryptTextLen, unsigned char *PlainText) {
 
    AES_KEY dec_key;
    long idx=0;
    unsigned char outBuff[MAX_AES_BUFF_SIZE];
    int ii, kk, jj;

    memset(outBuff, 0x00, MAX_AES_BUFF_SIZE);
 
    AES_set_decrypt_key(fw_aes_key, 128, &dec_key);
 
    size_t encPadLen = strlen(DecryptText) / 2;
    d_hex_convert(DecryptText, DecryptTextLen, outBuff);
 
    printf("d_makeAesPacket[%d]", strlen(outBuff));

    while(idx < encPadLen) {
        AES_ecb_encrypt(outBuff+idx, PlainText+idx, &dec_key, AES_DECRYPT);
        idx += AES_BLOCK_SIZE;
    }
    if(__debug) printf(">>%s\n", PlainText);

    jj=PlainText[encPadLen-1];
    ii=0;
    for(kk=encPadLen-2; kk>0; kk--)
    {
        if(PlainText[kk] == jj)
        {
            PlainText[kk]=0x00;
        }
        else break;
    }
    return(strlen(PlainText));
}

/* callback for curl fetch */
size_t curl_callback (void *contents, size_t size, size_t nmemb, void *userp) {
    size_t realsize = size * nmemb;                             /* calculate buffer size */
    struct curl_fetch_st *p = (struct curl_fetch_st *) userp;   /* cast pointer to fetch struct */

    /* expand buffer */
    p->payload = (char *) realloc(p->payload, p->size + realsize + 1);

    /* check buffer */
    if (p->payload == NULL) {
      /* this isn't good */
      fprintf(stderr, "ERROR: Failed to expand buffer in curl_callback");
      /* free buffer */
      free(p->payload);
      /* return */
      return -1;
    }

    /* copy contents to buffer */
    memcpy(&(p->payload[p->size]), contents, realsize);

    /* set new buffer size */
    p->size += realsize;

    /* ensure null termination */
    p->payload[p->size] = 0;

    /* return size */
    return realsize;
}

/* fetch and return url body via curl */
CURLcode curl_fetch_url(CURL *ch, const char *url, struct curl_fetch_st *fetch) {
    CURLcode rcode;                   /* curl result code */

    /* init payload */
    fetch->payload = (char *) calloc(1, sizeof(fetch->payload));

    /* check payload */
    if (fetch->payload == NULL) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to allocate payload in curl_fetch_url");
        /* return error */
        return CURLE_FAILED_INIT;
    }

    /* init size */
    fetch->size = 0;

    /* set url to fetch */
    curl_easy_setopt(ch, CURLOPT_URL, url);

    /* set calback function */
    curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, curl_callback);

    /* pass fetch struct pointer */
    curl_easy_setopt(ch, CURLOPT_WRITEDATA, (void *) fetch);

    /* set default user agent */
    curl_easy_setopt(ch, CURLOPT_USERAGENT, "libcurl-agent/1.0");

    /* set timeout */
    curl_easy_setopt(ch, CURLOPT_TIMEOUT, 30);

    /* enable location redirects */
    curl_easy_setopt(ch, CURLOPT_FOLLOWLOCATION, 1);

    /* set maximum allowed redirects */
    curl_easy_setopt(ch, CURLOPT_MAXREDIRS, 1);

    /* fetch the url */
    rcode = curl_easy_perform(ch);

    /* return */
    return rcode;
}

json_object *sbo634_wascall(char *MSGCODE, char *ACCNO, char *PAGE)
{
    CURL *ch;                                               /* curl handle */
    CURLcode rcode;                                         /* curl result code */

    json_object *json;                                      /* json post body */
    enum json_tokener_error jerr = json_tokener_success;    /* json parse error */

    struct curl_fetch_st curl_fetch;                        /* curl fetch struct */
    struct curl_fetch_st *cf = &curl_fetch;                 /* pointer to fetch struct */
    struct curl_slist *headers = NULL;                      /* http headers to send with request */
 
    char post_data  [1024*32] = {0x00,};
    unsigned char TextPlain  [1204L * 128L] = {0x00,};
 
    unsigned char inBuff[MAX_AES_BUFF_SIZE];
    unsigned char txParam[MAX_AES_BUFF_SIZE];
    unsigned char txRemark[MAX_AES_BUFF_SIZE];
 
    int rlen;

    /* url to test site */
    char *url = "http://cyper-01:44444/GW/rest/service.do";
    printf("[URL]%s\n", url);

    /* init curl handle */
    if ((ch = curl_easy_init()) == NULL) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to create curl handle in fetch_session");
        /* return error */
        return NULL;
    }

    /* set content type */
    //headers = curl_slist_append(headers, "Accept: application/json");
    //headers = curl_slist_append(headers, "Content-Type: application/json");

    /* create json object for post */
    json = json_object_new_object();

    /* build post data */
    json_object_object_add(json, "MSGCODE", json_object_new_string(MSGCODE)); 
    json_object_object_add(json, "ACCNO", json_object_new_string(ACCNO)); 
    json_object_object_add(json, "PAGE", json_object_new_string(PAGE)); 
 
    memset(inBuff, 0x00, sizeof(inBuff));
    sprintf(inBuff, "%s", json_object_to_json_string(json));
    printf(">>BEFORE ENCRYPT:::msg=%s\n", json_object_to_json_string(json));
    rlen = e_makeAesPacket(inBuff, strlen(inBuff), txRemark);
    if (rlen < 0) {
        printf("AesPacket make failed(%s)", inBuff);
        return NULL;
    }
    sprintf(post_data, "msg=%s", txRemark);
    printf(">>AFTER ENCRYPT:::%s", post_data);
    printf("\n\n\n\n");
 

    /* set curl options */
    curl_easy_setopt(ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(ch, CURLOPT_POSTFIELDS, post_data);
    curl_easy_setopt(ch, CURLOPT_VERBOSE, 1L);
    curl_easy_setopt(ch, CURLOPT_POST, 1L);

    /* fetch page and capture return code */
    rcode = curl_fetch_url(ch, url, cf);

    //FREE
    curl_easy_cleanup(ch);
    curl_slist_free_all(headers);
    json_object_put(json);

    /* check return code */
    if (rcode != CURLE_OK || cf->size < 1) {
        /* log error */
        fprintf(stderr, "ERROR: Failed to fetch url (%s) - curl said: %s",
            url, curl_easy_strerror(rcode));
        /* return error */
        return NULL;
    }

    /* check payload */
    if (cf->payload != NULL)

​    {
        /* print result */
        printf("CURL Returned: \n%s\n", cf->payload);
  
        rlen = d_makeAesPacket((unsigned char *)cf->payload, strlen(cf->payload), TextPlain);
        if (rlen < 0) {
            printf("d_makeAesPacket make failed(%s)", inBuff);
            return NULL;
        }
 
        /* parse return */
        json = json_tokener_parse_verbose(TextPlain, &jerr);
        /* free payload */
        free(cf->payload);
     }

     else

     {
        /* error */
        fprintf(stderr, "ERROR: Failed to populate payload");
        /* free payload */
        free(cf->payload);
        /* return */
        return NULL;
    }

    /* check error */
    if (jerr != json_tokener_success) {
        /* error */
        fprintf(stderr, "ERROR: Failed to parse json string");
        /* free json object */
        json_object_put(json);
        /* return */
        return NULL;
    }
    return json;
}

 

char CreditBalanceDefineName[44][100] = {"MSGCODE",
"RESULT","REASON","ACCNO","AO","LIMIT","CREDIT-AVAI","ASSETS","LIABILITIES",
"EQUITY","CASHBAL","LMV","COLLATERAL","DEBT","SMV","MR","BUYMR",
"SELLMR","EE","PP","CALLMARGIN","SHORTCALL","CALLFORCESELL","CALL_LMV","CALL_SMV",
"FORCE_LMV","FORCE_SMV","MARGINRATIO","WITHDRAWAL","ACTION","ACCEE","BUYCR50",
"BUYCR60","BUYCR70","MTMEE","MTMBUYCR50","MTMBUYCR60","MTMBUYCR70","MTMMRATIO",
"MTMCALLM35","TOTALBUY","TOTALSELL","PAGE","NEXTPAGE"};

 

 

char CreditPortDefineName[9][100] = {"MSGCODE",
"RESULT","REASON","ACCNO","TAMOUNT","TMKTVALUE","PAGE",
"NEXTPAGE","COUNT"};

 

int main(int argc, char *argv[])
{
    json_object *json = NULL;
    json_object *array = NULL;
    json_object *pdata = NULL;
    json_object *jvalue = NULL;
 
    char MSGCODE[MAX_FSS_STRING_SIZE];
    char ACCNO[MAX_FSS_STRING_SIZE];
    char PAGE[MAX_FSS_STRING_SIZE];
 
    int kk;
 
    if(argc < 2)
    {
        printf("[1]:MSGCODE>ACR, ACCNO>, PAGE>1 + DEBUG(D)\n");
        printf("[2]:MSGCODE>ACP, ACCNO>, PAGE>1 + DEBUG(D)\n");
        return(-1);
    }

    if(argc == 3)
    {
        if(argv[2][0] == 'D') __debug = 1;
        else __debug = 0;
    }
 
    memset(MSGCODE,0x00,sizeof(MSGCODE));
    memset(ACCNO,0x00,sizeof(ACCNO));
    memset(PAGE,0x00,sizeof(PAGE));
 
    if(argv[1][0] =='1')
    {
       strcpy(MSGCODE, "ACR");
       strcpy(ACCNO, "987654321");
       strcpy(PAGE, "1");  
    }
    else if(argv[1][0] =='2')
    {
       strcpy(MSGCODE, "ACP");
       strcpy(ACCNO, "987654321");
       strcpy(PAGE, "1");  
    }
    else
    {
       printf("Argument IS 1 or 2 !!!!!!!\n");
       return(-1);
    }
 
    json = sbo634_wascall(MSGCODE, ACCNO, PAGE);
    if(json == NULL) {
       return(-1);
    }
 
    /* debugging */
    printf("Parsed JSON: %s\n", json_object_to_json_string(json));
 
    char *creditvalue = NULL;
 
    printf("\n\n\n\n\n>>>>>>>>\n");

    if(argv[1][0]=='2')
    for(kk=0; kk<9; kk++)
    {
         if (json_object_object_get_ex(json, CreditPortDefineName[kk], &pdata)) {
         creditvalue = (char *)json_object_get_string(pdata);
         printf("[%.3d]%20s:[%s]\n", kk+1, CreditPortDefineName[kk], creditvalue);
         }
    }
  
    if(argv[1][0]=='1')
    for(kk=0; kk<44; kk++)
    {
         if (json_object_object_get_ex(json, CreditBalanceDefineName[kk], &pdata)) {
         creditvalue = (char *)json_object_get_string(pdata);
         printf("[%.3d]%20s:[%s]\n", kk+1, CreditBalanceDefineName[kk], creditvalue);
         }
    }
 
    json_object_put(json);
 
    return(0);

}

 

/*----복호화한 출력 JSON포맷 ----------------------------------------------------------------------------------------------

{ "PP": "3890427.94", "BUYMR": "0.00", "COLLATERAL": "0.00", "MTMEE": "1945213.97", "BUYCR70": "2778877.10", "CASHBAL": "1945213.97", "SHORTCALL": "1945213.97", "CREDIT-AVAI": "3890427.94", "TOTALB": "0.00", "LIMIT": "12000000.00", "LIABILITIES": "0.00", "DEBT": "0.00", "MARGINRATIO": "1.0000", "SHORTFORCE": "1945213.97", "MTMCALLM35": "0.35", "ACCNO": "0058866", "MTMBUYCR50": "3890427.94", "MTMBUYCR70": "2778877.10", "REASON": "complete", "BUYCR50": "3890427.94", "EQUITY": "1945213.97", "ASSETS": "1945213.97", "EE": "1945213.97", "BUYCR60": "3242023.28", "MSGCODE": "RCR", "MR": "0.00", "SELLMR": "0.00", "CALLMARGIN": "0.00", "CALLFORCESELL": "0.00", "AO": "9233", "ACCEE": "1945213.97", "LMV": "0.00", "CALL_SMV": "40.00", "ACTION": "", "FORCE_SMV": "30.00", "TOTALS": "0.00", "MTMBUYCR60": "3242023.28", "CALL_LMV": "35.00", "MTMMRATIO": "0.00", "SMV": "0.00", "WITHDRAWAL": "1945213.97", "RESULT": "0", "FORCE_LMV": "25.00" }

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

/*----복호화한 출력 JSON포맷 ----------------------------------------------------------------------------------------------

{ "STOCKLISTS": [ ], "ACCNO": "0058866", "MSGCODE": "RCP", "TAMOUNT": "0.00", "PAGE": "1", "COUNT": "0", "NEXTPAGE": "0", "TMKTVALUE": "0.00", "REASON": "complete", "RESULT": "0" }

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


 

/**
 @file
 @copyright COPYRIGHT ⓒ2017 SUKSU COMPUTER. ALL RIGHTS RESERVED. <br/>
 @note
 @author
 @section history Major History

 

* 어떤 JSON데이타를 자동으로 파싱하려고 하면, 굉장히 복잡하다. 우리는 REQUEST와 RESPONSE에 서로 규약되어 있는

데이타의 포맷에 맞춰서 JSON함수를 이용해, 데이타를 파싱하면 된다.

이는 소켓통신에서, 데이타의 규약과 마찬가지라고 보면 될것이다. 즉 RESPONSE JSON데이타의 포맷과 형식을 미리알고 있어야한다.
​     


​      */

 

 

#include <json-c/json.h>    //REDHAT LINUX계열
#include <stdio.h>
#include <string.h>

 

//컴파일방법

//gcc json2.c -ljson-c -o json2

 

char buf[1204L * 128L];

 

int main(int argc, char *argv[]) 
{
     FILE *fp = fopen(argv[1], "r");
 
     if(argc != 2)
     {
        printf("gcc json2.c -lcrypto -lcurl -ljson-c -o json2\n");
        return(-1);
     }
 
     if(NULL == fp)
     {
        fprintf(stderr, "fopen() failed");
        return -1;
     }

     int n = fread(buf, 1, sizeof(buf), fp);
     buf[n] = 0;

     struct json_object *jobj = NULL;

     jobj = json_tokener_parse(buf);    // ALREADY FORMATTING, SO, USE ONLY
     if(NULL == jobj) {
        return -1;
     }
 
     char KEY[100], SUBKEY[100];

     memset(KEY, 0x00, sizeof(KEY));
     strcpy(KEY, "result");
     printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(jobj, KEY)) );
 
     memset(KEY, 0x00, sizeof(KEY));
     strcpy(KEY, "reason");
     printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(jobj, KEY)) );
 
     struct json_object *pdata = NULL;
     if(json_object_object_get_ex(jobj, "summary", &pdata)) 
     {
        memset(KEY, 0x00, sizeof(KEY));
        strcpy(KEY, "totalpaid");
        printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(pdata, KEY)) );
  
        memset(KEY, 0x00, sizeof(KEY));
        strcpy(KEY, "totalreceived");
        printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(pdata, KEY)) );
  
        memset(KEY, 0x00, sizeof(KEY));
        strcpy(KEY, "totalunpaid");
        printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(pdata, KEY)) );
  
        memset(KEY, 0x00, sizeof(KEY));
        strcpy(KEY, "totalunreceived");
        printf("[%s][%s]\n", KEY, json_object_get_string(json_object_object_get(pdata, KEY)) );
    } 

    //struct json_object *pdata = NULL;
    if(json_object_object_get_ex(jobj, "data", &pdata)) 
    {
        int i;
        //int  json_object_array_length (struct json_object *obj) 
        for (i = 0; i < json_object_array_length(pdata); i++) 
        {
            //struct json_object *  json_object_array_get_idx (struct json_object *obj, int idx) 
            struct json_object *tmp = json_object_array_get_idx(pdata, i);
  
            printf("-----------------------------------\n");
            /*
            {"tradedate":"20170124",
             "settledate":"20170124",
             "cdrefer":"CN-20170124-01027",
             "amount":264554.830000,
             "status":"Received"
            },
            */
            memset(KEY, 0x00, sizeof(KEY));
            strcpy(KEY, "tradedate");
            printf("[%s][%s]", KEY, json_object_get_string(json_object_object_get(tmp, KEY)) );

            memset(KEY, 0x00, sizeof(KEY));
            strcpy(KEY, "settledate");
            printf("[%s][%s]", KEY, json_object_get_string(json_object_object_get(tmp, KEY)) );

            memset(KEY, 0x00, sizeof(KEY));
            strcpy(KEY, "cdrefer");
            printf("[%s][%s]", KEY, json_object_get_string(json_object_object_get(tmp, KEY)) );

            memset(KEY, 0x00, sizeof(KEY));
            strcpy(KEY, "amount");
            printf("[%s][%s]", KEY, json_object_get_string(json_object_object_get(tmp, KEY)) );

            memset(KEY, 0x00, sizeof(KEY));
            strcpy(KEY, "status");
            printf("[%s][%s]", KEY, json_object_get_string(json_object_object_get(tmp, KEY)) );

            printf("\n");
       }
   }
   return 0;
}

 

 

 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <time.h>

#include <fcntl.h>

#include <errno.h>

 

#define MAX_CNT 10

#define MAXTIX (24*60)

 

int l_xupdate(int xfds, char *a1, char *a2);

 

struct xxxidx 

{

int  recs; // record size

int recn[MAXTIX]; // Starting Record of HHMM

};

 

struct biglotTrade 

{

char    symbol[20];                

char    orderbookid[12];      

long biglotOrderQty; //VOLUME

int     biglotSequence;

long    biglotTotalVolumeTraded; //TOTAL VOLUME

double  biglotTurnover; //AMT

int     typeOfTrade;    //CASE 1 NEW, CASE 2 CANCEL(MUST)

double  doubleprice;

double  totalTurnoverTradeReport; //TOTAL AMT

char    tradeId[30];

char    dealId[30];

};

 

char DNS_PACKET[55][2][100] = {

{"TN-1-1508147706984-2","DN-1-1508147706984-1"},

{"TN-1-1508147696497-2","DN-1-1508147696497-1"},

{"TN-1-1508147685915-2","DN-1-1508147685915-1"},

{"TN-1-1508147668355-2","DN-1-1508147668355-1"},

{"TN-1-1508147651212-2","DN-1-1508147651212-1"},

{"TN-1-1508147637492-2","DN-1-1508147637492-1"},

{"TN-1-1508147635403-2","DN-1-1508147635403-1"},

{"TN-1-1508147624602-3","DN-1-1508147624602-2"},

{"TN-1-1508147579369-3","DN-1-1508147579369-2"},

{"TN-1-1508147553972-2","DN-1-1508147553972-1"}};

 

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

{

struct biglotTrade biglottrade[500];

int  xxfd;

char xfile[32];

int  ii, jj, cnt, rc;

 

sprintf(xfile, "%.20s", "BIGLOT");

xxfd = l_xopen(SAMFILE_PATH, xfile, O_RDWR);  //FOR UPDATE, RDWR NEEDED!!

if (xxfd < 0)

{

printf("Can't open BIGLOT file [%s][%s]. errno(%d)\n", DAT_JC_PATH, xfile, errno);

return(-1)

}

 

for (jj = 0; jj < MAX_CNT; jj++)

{

rc = l_xupdate(xxfd, DNS_PACKET[jj][0], DNS_PACKET[jj][1]);

if(rc)

{

printf("l_xupdate fail!!\n");

return(-1);

}

}

 

close(xxfd);

return 0;

}

 

int l_xupdate(int xfds, char *a1, char *a2)

{

struct  xxxidx  xxxidx;

struct  biglotTrade *tmpdjd;

int  rlen, wlen;

int  xsiz;

int maxr;

int  ii, cnt;

 

long xoff;

char buff[1024 * 100];

 

lseek(xfds, 0L, SEEK_SET);

rlen = read(xfds, &xxxidx, sizeof(struct xxxidx));

if (rlen != sizeof(struct xxxidx))

    {

printf("rlen failed\n");

return -1;

}

 

xsiz = xxxidx.recs;

 

xoff = lseek(xfds, 0L, SEEK_END);

maxr = (xoff - sizeof(struct xxxidx)) / xsiz;

if (maxr <= 0) {

printf("maxr failed\n");

return -1;

}

 

xoff = sizeof(struct xxxidx);

cnt = lseek(xfds, xoff, SEEK_SET);

 

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

{

rlen = read(xfds, buff, xsiz);

 

tmpdjd = (struct biglotTrade *)buff;

 

if (strcmp(tmpdjd->tradeId,a1)==0 &&

          strcmp(tmpdjd->dealId,a2)==0)

{

xoff = sizeof(struct xxxidx) + (ii * xsiz);

cnt = lseek(xfds, xoff, SEEK_SET);

 

tmpdjd->typeOfTrade = 1; //UPDATE DATA 

wlen = write(xfds, tmpdjd, sizeof(struct biglotTrade));

printf("wlen = %d\n", wlen);

 

break;

}

}

return 0;

}

 

#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$

*/

 

+ Recent posts