VC读写函数详解(针对文件).doc

VC读写函数详解(针对文件)

VC读写函数.当前文件指针位置获取函数 long ftell( FILE *stream ); 参数:stream 文件指针 返回值:当前文件指针的位置 实例: #include stdio.h FILE *stream; void main( void ) { ?? long position; ?? char list[100]; ?? if( (stream = fopen( ftell.c, rb )) != NULL ) ?? { ????? /* Move the pointer by reading data: */ ????? fread( list, sizeof( char ), 100, stream ); ????? /* Get position after read: */ ????? position = ftell( stream ); ????? printf( Position after trying to read 100 bytes: %ld\n, ????????????? position ); ????? fclose( stream ); ?? } } 输出: Position after trying to read 100 bytes: 100 2.文件的打开函数 FILE *fopen( const char *filenam

文档评论(0)

1亿VIP精品文档

相关文档