A few pointers for you:
>void main(void)
main returns an int. Use
>int main(void)
and return something at the end of the main function.
>test1 = fopen("c:\\output.txt", "w");
>test = fopen("c:\\banana.txt", "r");
Always test that the open worked (by checking that test1/test are not NULL)
>while (!feof(test))
You shouldn't control the read loop in this fashion, feof() isn't meant for this. Instead, use the return code from fgets().
Now, you can "skip" the lines you don't want by simply coding an if statement around the fprintf() statement Although the simplest way to miss the first line is probably to perform a "dummy" call to fgets() to read the first line, then another to get the second line straight away. Something like
Code:
if (fgets(.....)) /* Reads first line */
{
while (fgets(....)) /* Reads the rest */
{
/* do some output stuff here */
}
}
Knowing when you've just read in the last line is a little trickier, but I'll leave that one for you to ponder over for now