Hello,
I am new to programming and I was wondering if someone could help me with a question? I needing to know if there is a way to write a program that will get particular lines out of a file and print the out put to another file? For example here is code that I used to get a file and output it to another file:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<ctype>
#include<mem.h>
#define max 400

FILE *test;
FILE *test1;

void main(void) {

char word[max];
//char word1[max]="BANANA BREAD";

test1=fopen("c:\\output.txt","w");
test=fopen("c:\\banana.txt","r");
fgets(word,max,test);
while(!feof(test)) {
//if(memcmp(word,word1,12)==0)
// strcat(word, "once on the lips, twice on the hips :-) ");
fprintf(test1, "%s", word);
fgets(word,max,test);
}
fclose(test);
fclose(test1)
}

this actually works to my suprise! It copies a banana bread recipe to a output file. My question is this...is there a way to make the program skip the first line and the last line (for example) in the txt and print the rest to the output file? Thanks for any help on this ! I'm using Borland 4.5 if that makes any difference.