제목 그대로 int형으로 선언 된 1234라는 숫자를 char * 형으로 바꾸고 싶습니다. 단순히
int i; char *buf; i = 1234;
buf = (char *)&i; 또는 buf = (char *)i;
로는 않되더군여~ 한 수 가르침을 부탁 드립니다. 꾸벅
int i = 1234; char str[5]; sprintf( str,"%d", i );
printf( "str===> %s\n", str );
sprintf 함수를 사용해 보세요.
int i = 1234; char buf[5];
sprintf( buf, "%d", i );
님들의 가르침에 고개 숙여 감사 드립니다. 꾸벅~~
man strtod
int i = 444; char str[5]; sprintf( str,"%d", i );
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
Re: 숫자를 문자로 바꾸고 싶습니다.
int i = 1234;
char str[5];
sprintf( str,"%d", i );
printf( "str===> %s\n", str );
Re: 숫자를 문자로 바꾸고 싶습니다.
sprintf 함수를 사용해 보세요.
int i = 1234;
char buf[5];
sprintf( buf, "%d", i );
Re^2: 고개 숙여 감사 드립니다 꾸벅~~.
님들의 가르침에 고개 숙여 감사 드립니다. 꾸벅~~
Re^2: 숫자를 문자로 바꾸고 싶습니다.
man strtod
int i = 444; char str[5]; sprintf( s
int i = 444;
char str[5];
sprintf( str,"%d", i );
printf( "str===> %s\n", str );
댓글 달기