#C (프로그래밍 언어) 개요

C는 1972년 켄 톰슨과 데니스 리치가 벨 연구소에서 일할 당시 새로 개발된 유닉스 운영 체제에서 사용하기 위해 
개발한 프로그래밍 언어이다. 
켄 톰슨은 BCPL언어를 필요에 맞추어 개조해서 "B"언어(언어를 개발한 벨 연구소의 B를 따서)라 명명했고, 
데니스 리치가 이것을 개선하여 C 언어가 탄생했다. 
유닉스 시스템의 바탕 프로그램은 모두 C로 작성되었고, 
수많은 운영 체제의 커널 또한 C로 만들어졌다. 
오늘날 많이 쓰이는 C++는 C에서 객체 지향형 언어로 발전된 것이다. 
또 다른 다양한 최신 언어들도 그 뿌리를 C에 두고 있다.

#Console Hexa, form Hexa by c language

1. Console Hexa

#소스파일첨부

common.c
0.01MB
common.h
0.00MB
mainsrc.c
0.00MB

 

 

#Form Hexa

#소스파일첨부

wincommon.c
0.01MB
wincommon.h
0.00MB
winmainsrc.c
0.01MB

 

 

 

//DateTime -> UnixTimestamp -> DateTime 변환

//DateTime -> UnixTimestamp -> DateTime 변환

 

#include<stdio.h>

#include<time.h>

 

int GetUnixTimeT(int year, int month, int day, int hour, int minute, int second)

{

  struct tm t = {0};

 

  t.tm_year = year - 1900;

  t.tm_mon = month - 1;

  t.tm_mday = day;

  t.tm_hour = hour;

  t.tm_min = minute;

  t.tm_sec = second;

 

  return(mktime(&t));

}

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

{

  time_t t = time(NULL);

  struct tm tm = *localtime(&t);

 

  int ____year = tm.tm_year + 1900;

  int ____month = tm.tm_mon = month + 1;

  int ____day = tm.tm_mday;

  int ____hour = tm.tm_hour;

  int ____minute = tm.tm_min;

  int ____second = tm.tm_sec;

 

  printf("DateTime(1):[%d-%d-%d %d:%d:%d]\n", ____year,

    ____month, ____day, ____hour, ____minute, ____second);

 

  time_t baseTime = GetUnixTimeT(____year,

            ____month, ____day, ____hour, ____minute, ____second);

 

  printf("UnixTimestamp:[%ld]\n", baseTime);

 

  struct tm *tmmm = (struct tm *)localtime(&baseTime);

 

  ____year = tmmm->tm_year + 1900;

  ____month = tmmm->tm_mon = month + 1;

  ____day = tmmm->tm_mday;

  ____hour = tmmm->tm_hour;

  ____minute = tmmm->tm_min;

  ____second = tmmm->tm_sec;

 

  printf("DateTime(2):[%d-%d-%d %d:%d:%d]\n", ____year,

    ____month, ____day, ____hour, ____minute, ____second);

 

  return(0);

}

 

 

 

 

  

 

#Compile

gcc -I/usr/local/jdk1.7.0_79/include -I/usr/local/jdk1.7.0_79/include/linux -I/usr2/sinfo/src/include -I/usr/local/mysql/include -I./../jni_include  -fPIC -g -c -Wall SiseLibJong.c

 

gcc -I/usr/local/jdk1.7.0_79/include -I/usr/local/jdk1.7.0_79/include/linux -I/usr2/sinfo/src/include -I/usr/local/mysql/include -I./../jni_include  -fPIC -g -c -Wall ShmOpJong.c

 

 

#Link(so)

#gcc -shared -fPIC -o libShmJong.so SiseLibJong.so ShmOpJong.so

../util/Common.o /usr2/sinfo/src/util/MEMORY.o /usr2/sinfo/src/util/IPC.o /usr2/sinfo/src/util/STRLIB.o /usr2/sinfo/src/util/FUNC.o -lm -lpthread -lnsl

 

#Link(exe)

#gcc -o exeShmJong SiseLibJong.so ShmOpJong.so

../util/Common.o /usr2/sinfo/src/util/MEMORY.o /usr2/sinfo/src/util/IPC.o /usr2/sinfo/src/util/STRLIB.o /usr2/sinfo/src/util/FUNC.o -lm

-lpthread -lnsl

 

 

 

 

Makefile
0.00MB

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

int main(int argc, char *argv[])
{
    char *str = "ffffffaaaabcccddeeeeeffffgghijklmmmmnnnnopppqrstuuuuuvwxxxxxyyyyz";

int index[strlen(str)][2];

int kk, ff;

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

    for(kk=0; kk<strlen(str); kk++)
{
index[kk][0] = *(str+kk);
}

    for(ff=0; ff<strlen(str); ff++)
{
    for(kk=0; kk<strlen(str); kk++)
    {
        if(index[ff][0] == index[kk][0]) index[ff][1]++;
}
}

for(kk=0; kk<strlen(str); kk++)
{
if(index[kk][1] ==1)
printf("[%c]>>>>[%d]\n", index[kk][0], index[kk][1]);
}


return(0);
}


/*
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\SIHOO\Downloads\example>__11
[b]>>>>[1]
[h]>>>>[1]
[i]>>>>[1]
[j]>>>>[1]
[k]>>>>[1]
[l]>>>>[1]
[o]>>>>[1]
[q]>>>>[1]
[r]>>>>[1]
[s]>>>>[1]
[t]>>>>[1]
[v]>>>>[1]
[w]>>>>[1]
[z]>>>>[1]
*/

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

int main(int argc, char *argv[])
{
    char *str = "ffffffaaaabcccddeeeeeffffgghijklmmmmnnnnopppqrstuuuuuvwxxxxxyyyyz";

int kk, ff;

    if(strlen(str) > 3)
{
kk=0;
if(!( *(str+kk) == *(str+kk+1))) printf("%c", *(str+kk));

for(kk=1; kk<strlen(str) -1; kk++)
{
if(*(str+kk) == *(str+kk+1)) continue;
if(*(str+kk) == *(str+kk-1)) continue;

printf("%c", *(str+kk));
}
if(!( *(str+kk) == *(str+kk-1))) printf("%c", *(str+kk));
}
else
{
if(strlen(str) == 3)
{
kk=0;
     if(!( *(str+kk) == *(str+kk+1))) printf("%c", *(str+kk));

kk++;

ff=0;
if(*(str+kk) == *(str+kk+1)) ff=100;
if(*(str+kk) == *(str+kk-1)) ff=100;
if(ff==0)
{
printf("%c", *(str+kk));
}

kk++;
if(!( *(str+kk) == *(str+kk-1))) printf("%c", *(str+kk));
}
else if(strlen(str) == 2)
{
kk=0;
     if(!( *(str+kk) == *(str+kk+1))) printf("%c", *(str+kk));

kk++;
if(!( *(str+kk) == *(str+kk-1))) printf("%c", *(str+kk));
}
else
{
kk=0;
printf("%c", *(str+kk));
}
}

return(0);
}

extern char design[6][2+1];
extern int ____hexa[MAPY][MAPX];
extern int hexa[MAPY][MAPX];

 

 

 

void gotoxy(int x, int y)
{
    COORD Pos = {x - 1, y - 1};
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}

void f_display_all(void)
{
    int i, k;

    for(i=0; i<MAPY; i++)
    {
        for(k=0; k<MAPX; k++)
        {
            if(hexa[i][k] == 10)
            {
                continue;
            }
            else if(hexa[i][k] == 0)
            {

                gotoxy(k * 2 + 1, i + 2);
                printf("□");

            }
            else
            {
               gotoxy(k * 2 + 1, i + 2);
               printf("%s", design[ hexa[i][k] ]);
            }
        }
    }


#if(1)
for(i=0; i<MAPY; i++)
    {
        for(k=0; k<MAPX; k++)
        {
____hexa[i][k] = hexa[i][k];
}
}
#endif
}

void f_display(int x, int y)
{
    int i, k;

#if(1)
    for(i=0; i<MAPY; i++)
    {
        for(k=0; k<MAPX; k++)
        {
            if(hexa[i][k] == 10)
            {
                continue;
            }
else if(hexa[i][k] == ____hexa[i][k]) continue;
            else if(hexa[i][k] == 0)
            {

                gotoxy(k * 2 + 1, i + 2);
                printf("□");

            }
            else
            {
               gotoxy(k * 2 + 1, i + 2);
               printf("%s", design[ hexa[i][k] ]);
            }
        }
    }
#endif

#if(1)
for(i=0; i<MAPY; i++)
    {
        for(k=0; k<MAPX; k++)
        {
____hexa[i][k] = hexa[i][k];
}
}
#endif
}

#if(1)
    if(____type==0)  //처음 한번은 전체출력으로 하고, 다음부터는 변한부분만 출력하도록 한다.
{
        for(i=0; i<MAPY; i++)
{
            for(k=0; k<MAPX; k++)
                {
if(hexa[i][k] == 10)
{
continue;
}
else if(hexa[i][k] == 0)
{
TextOut(hdc, screenxpos + 8 * 2 * k, screenypos + 8 * 2 * i, "□", 2);
}
else
{
TextOut(hdc, screenxpos + 8 * 2 * k, screenypos + 8 * 2 * i, design[ hexa[i][k] ], 2);
}
}
}
____type=1;
}
else
{
for(i=0; i<MAPY; i++)
{
for(k=0; k<MAPX; k++)
{
if(hexa[i][k] == ____hexa[i][k]) continue;
else if(hexa[i][k] == 0)
{
TextOut(hdc, screenxpos + 8 * 2 * k, screenypos + 8 * 2 * i, "□", 2);
}
else
{
TextOut(hdc, screenxpos + 8 * 2 * k, screenypos + 8 * 2 * i, design[ hexa[i][k] ], 2);
}
}
}
}
#endif

+ Recent posts