list2.c:51:5: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] printf("%.12s ", ctime(&st->st_mtime)+4);
리눅스에서 파일수정 시간을 출력하려고 하는데 원하는 결과는 나오지만 워닝이 떱니다. 설명좀 부탁드리겠습니다.
#include <time.h>
이런거 해야 ctime의 return 값이 제대로 char * 인 줄 압니다. default로는 int로 생각하고 처리할테니 저런 warning이 생깁니다.
---http://coolengineer.com
텍스트 포맷에 대한 자세한 정보
<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]
include
#include <time.h>
이런거 해야 ctime의 return 값이 제대로 char * 인 줄 압니다. default로는 int로 생각하고 처리할테니 저런 warning이 생깁니다.
---
http://coolengineer.com
댓글 달기