技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

能打印自己源码的C程序的版本2

版本2

#include <stdio.h>;

int main()
{
    FILE *f;
    char c;

    if ( ( f = fopen( __FILE__, "r" ) ) != NULL )
    {
      while ( fread( &c, 1, 1, f ) == 1 )
          fwrite( &c, 1, 1, stdout );
      fclose( f );
    }
    return 0;
}

posted on 2012-04-25 23:48  codestyle  阅读(168)  评论(0)    收藏  举报