QUOTE(AmitTheInfinity @ 9 Jun, 2008 - 11:38 PM)

There are few problems in your code. I am modifying your for loop to make it work
cpp
char str[100];
int line_no;
fprintf(output,"***************** %s ***************\n", name);
line_no = 0;
while(input != EOF || input!=NULL)
{
fgets(str,100,input);
line_no++;
fprintf(output,"%d : ",line_no);
fputs(str,output);
}
Please see for syntax errors. I hope this will help you.

Ihave got it to compile with only one warning "Comparison between pointer and integer" this is in reference to the while(input != EOF || input = NULL). Here is the complete code.
CODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *input, *output;
char ch;
char name[30];
strcpy(name, argv[2]);
strcat(name, ".lis");
input = fopen(argv[1], "r");
if (input == NULL) {
printf("\nCannot open file %s for input\n", argv[1]);
exit(1);
}
output = fopen(name, "w");
if (output == NULL) {
printf("\nCannot open file %s for output\n", name);
exit(1);
}
char str[100];
int line_no;
fprintf(output, "***************** %s ***************", name);
line_no = 0;
while(input != EOF || input != NULL)
{
fgets(str,100,input);
line_no++;
fprintf(output, "%d : ", line_no);
fputs(str, output);
}
fclose(input);
fclose(output);
printf("\nCopied %s to %s\n", argv[1], name);
return(0);
}
what would the problem be? also when it runs I receive The following error:
"6 [main] assignment_7_1 3812 _cygutls::handle_exceptions: Error while dumping state (probably corrupted stack)
/cygdrive/c/Users/Larry/.netbeans/6.1/bin/dorun.sh: line 103: 3812 Segmentation fault (core dumped) "$pgm" "$@" "
I use cgywin as my compiler with netbeans 6.1, is this a runtime error?