I want to write a program to print all words containing a letter ("D" for example) in a text file.

This is what I came up with, but it does not work.

I get the core dumped error.

```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BUFFER_SIZE 1000

int findWord(FILE *file , const char *letter);

void main()
{   
    FILE *file; 
    char path[100];

    char letter[1];

    printf("Enter file path: ");
    scanf("%s", path);

    printf("Enter letter to search in file: ");
    scanf("%s", letter);

    file = fopen(path, 'r');

    if (file == NULL)
    {
        printf("Unable to open file.\n");
        printf("Please check you have read/write priveleges.\n");

        exit(EXIT_FAILURE);
    }

    findWord(file, letter);

    fclose(file);

    return 0;
}

int findWord(FILE *file, const char *letter)
{
    char str[BUFFER_SIZE];

    while ((fgets(str, BUFFER_SIZE, file)) != NULL)
    {
        if (str == letter)
        {
            printf(letter);
        }
    }

}

```