c程序代码错误有没有大神指点一二。
/*list_it.c_THisprogramdisplaysalistingwithlinenumbers!*/#include<stdio.h>#include<st...
/* list_it.c_THis program displays a listing with line numbers! */
#include <stdio.h>
#include <stdlib.h>
void display_usage(void);
int line;
int mian( int argc, char *argv[] )
{
char buffer[256];
FILE *fp
if( argc < 2 )
{
display_usage();
return 1;
}
if (( fp = fopen( argv[1], "r" )) == NULL )
{
fprintf( stderr, "Error opening file, %s!", argv[1]);
return(1);
}
line = 1;
while( fgetd( buffer, 256, fp ) != NULL )
fprintf( stdout, "%4d:\t%s", line++, buffer );
fclose(fp);
return 0;
}
void display_usage(void)
{ fprintf(stderr, "\nproper Usage is: " );
fprintf(stderr, "\n\nlist_it filename.ext\n" );
} 展开
#include <stdio.h>
#include <stdlib.h>
void display_usage(void);
int line;
int mian( int argc, char *argv[] )
{
char buffer[256];
FILE *fp
if( argc < 2 )
{
display_usage();
return 1;
}
if (( fp = fopen( argv[1], "r" )) == NULL )
{
fprintf( stderr, "Error opening file, %s!", argv[1]);
return(1);
}
line = 1;
while( fgetd( buffer, 256, fp ) != NULL )
fprintf( stdout, "%4d:\t%s", line++, buffer );
fclose(fp);
return 0;
}
void display_usage(void)
{ fprintf(stderr, "\nproper Usage is: " );
fprintf(stderr, "\n\nlist_it filename.ext\n" );
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询