Views 8122 Votes 0 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

숫자를 hex 코드로 변환

/* print input in hex */
void print_hex( int input ){
    int var, i;
    int len = 0;
    char buf[255];

    do{
        var = input % 16;
        input /= 16;

        /* try to convert ascii code */
        if( var<10 ) buf[len] = var+48;
        else buf[len] = var+55;
        len++;
    }while( input>0 ); /* bigger than 16? then try again */

    /* print reversely */
    for ( i=len; i>0; i-- ) putchar( buf[i-1] );
    putchar( '\n' );

}

int main( int argc, char** argv ){
    int input;

    printf( "input number: " );
    scanf( " %d", &input );

    /* print hex with printf */
    printf( "%x\n", input );

    /* print hex with my function */
    print_hex( input );

    return 0;

}

?

List of Articles
No. Category Subject Author Date Views
69 Develop [android] dp, px 서로 변환 hooni 2016.10.21 3375
68 Develop [android] Canvas를 이용해 이미지 확대/축소 하기 hooni 2013.04.23 60741
67 Develop [android] Calling activity function from separate class hooni 2016.11.15 1157
66 Develop [android] ArrayAdapter를 이용하여 출력하기 hooni 2013.04.23 47339
65 Develop [android] ArrayAdapter 테스트 파일 ㅎㅎ hooni 2013.04.23 45241
64 Develop [android] Android N requires the IDE to be running with Java 1.8 or later 오류 hooni 2016.08.30 687
63 Develop [android] AlertDialog 메시지 창 띄우기 hooni 2015.07.09 849
62 Develop [Android] 2010년에 만들었던 세미나 자료. file hooni 2013.05.28 64661
61 Develop [Android Error] The number of method references in a .dex file cannot exceed 64K hooni 2016.11.10 756
60 Algorithm [algorithm] Greedy (탐욕 기법) hooni 2003.04.23 15108
59 PPT [ajax] 크로스 도메인(Cross Domain) 이슈 해결 방안 file hooni 2013.04.23 21937
58 Develop [ajax] 이벤트 코드 생성기 작업중.. ㅋㅋ file hooni 2013.04.23 7116
57 Develop [ajax] 샘플 코드와 한글처리에 대한 간단한 설명 hooni 2013.04.23 6842
56 Develop ZBar 라이브러리를 이용한 바코드 스캔 앱 개발하기 file hooni 2015.01.01 1628
55 Develop XML, JSON, BSON, MSGPACK 장,단점 비교 file hooni 2017.01.11 2242
54 Develop XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그 file hooni 2016.04.21 866
Board Pagination Prev 1 ... 68 69 70 71 72 74 Next
/ 74