日付を表す文字列→struct tmへの変換メモ

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

int main(int argc, char** argv){
    if ( argc < 2 || strlen(argv[1]) < 8 )
    {
        return -1;
    }
    /* struct tm の初期化 */
    struct tm tmbuf;
    memset(&tmbuf,0x00,sizeof(struct tm));
    /* 文字列→struct tmへの変換 */
    if(strptime(argv[1],"%Y%m%d",&tmbuf)==NULL)
    {
        fprintf(stderr,"%s\n",strerror(errno));
    }
    /* 変換後文字列の初期化 */
    char buf[15];
    memset(buf,0x00,sizeof(buf));
    /* struct tm → 文字列への変換 */
    if(strftime(buf,sizeof(buf),"%Y%m%d%H%M%S",&tmbuf)!=14)
    {
        fprintf(stderr,"error?");
    }
    fprintf(stdout,"%s\n",buf);
    return 0;
}

ここら辺を参考にした。
http://www.linux.or.jp/JM/html/LDP_man-pages/man3/strptime.3.html
http://www.linux.or.jp/JM/html/LDP_man-pages/man3/strftime.3.html