I have a buffer that looks like this:

```
char *buffer;

```

The content of the buffer looks like this:

```
apple; apple fruit \t data \n
apple tree \t data \n
apple pie \t data \n
Holland; Netherlands; The Netherlands '\t' data \n
....

```

I want to search for one of those words.

I can find the word in the buffer. However, if I am looking for apple I end up getting from apple to the end of the buffer, all the lines below apple. It just discards everything above. So I want to cut out at the end of data when I hit \n.

I tried this:

```
   // find the word.
char *found = strstr(buffer, word);

// try to keep the line containing the word and the data 
// but discard everything after '\n'
found = strchar(found, '\n');
*(found +1) = 0;

printf(found);

```

Then when I try to printf I don't print anything at all. So when I run `strchar` I ruin everything. If I comment out the `strchar` part I can see my word and definition + everything else left in the buffer.