R
Rafael
Hello Everyone,
I need some major help with this code I have for a file viewer. I
need it to stop at the 24th line. What Syntax do I need for this to
happen?
Here is the code....
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i;
FILE *fp;
char buf[24];
if(argv[1]==NULL)
{
printf("ERROR: Please enter a file name afer char.exe or
char.\n");
system("PAUSE");
}
else
{
fp = fopen(argv[1],"r");
while (!feof(fp))
{
puts(buf);
fgets(buf,sizeof(buf)-1,fp);
}
}
return 0;
}
I need some major help with this code I have for a file viewer. I
need it to stop at the 24th line. What Syntax do I need for this to
happen?
Here is the code....
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i;
FILE *fp;
char buf[24];
if(argv[1]==NULL)
{
printf("ERROR: Please enter a file name afer char.exe or
char.\n");
system("PAUSE");
}
else
{
fp = fopen(argv[1],"r");
while (!feof(fp))
{
puts(buf);
fgets(buf,sizeof(buf)-1,fp);
}
}
return 0;
}