请问这段代码有何错误?求解!
急啊~~求解!!/*print_it.c-This program prints a listing with line numbers!*/
#include <stdlib.h>
#include <stdio.h>
void do_heading(char *filename);
int line = 0, page = 0;
int main( int argv, char *argc[] )
{
char buffer;
FILE *fp;
if( argv < 2 )
{
fprintf(stderr, "\nProper Usage is: ");
fprintf(stderr, "\n\nprint_it filename.ext\n");
return (1);
}
if (( fp = fopen( argc, "r" )) == NULL )
{
fprintf( stderr,"Error opening file, %s!",argc);
return(1);
}
page = 0;
line = 1;
do_heading( argc);
while( fgets( buffer, 256, fp ) != NULL )
{
if( line % 55 == 0 )
do_heading( argc );
fprintf( stdprn, "%4d:\t%s", line++, buffer );
}
fprintf( stdprn, "\f" );
fclose(fp);
return 0;
}
void do_heading( char *filename )
{
page++;
if ( page > 1)
fprintf( stdprn, "\f" );
fprintf( stdprn, "Page: %d, %s\n\n", page, filename );
}
顶一个{:1_1:} 我想说 stdprn是什么?标准里有么?我不知道。。。 程序不完整啊!要在程序开始处定义stdprn, FILE *stdprn; 你的提问方式有问题,你没说明是什么问题,也没给出错误标记.
页:
[1]