I need copy defined parts from input.txt file to new output.txt file.
These parts started with text-string "start" and finished with text-string "stop".
Eg. input.txt file:
001 some text...
I found only parts of solution:
Variables: line = line-string, fr = input.txt, fw = output.txt, ab = "ab ", start = "start", stop = "stop" :
Could you help me, please how can I read strings from input.txt only between strings start and stop?
while (fgets(line, 80, fr) != NULL) /*write each line of input.txt to variable "line" until EOF*/
if (strstr(line, start) != NULL) /*find start-string, but "if" is wrong!*/
if (strncmp(line, ab, 3) == 0) putc(line,fw); /*write 3rd charecters from line to output.txt*/
I think that it can be possible to use another while-loop but I am not yet successful.