Hi all,

Please help me wid the code below..it gives a segmentation fault on execution..
compilation is clean..m running it on gcc (linux)..

its a simple program to copy text from a file and store in a local variable
cannot figure out wat 2 do

Code:
#include<stdio.h>
#include<string.h>
#define IN 1
#define OUT 0

main()
{
FILE *fp;
char *ch = "";
char *str = "";
int c, state;
state = OUT;

printf("HI all");
fp = fopen("output.txt", "r");
if(fp == NULL)
{
    puts("\nCannot open source");
    return(0);
}

while ((c = fgetc(fp)) != EOF)
{
    if (c == ' ' || c == '\n' || c == '\t')
    {
        state = OUT;
    }
    else
    {
        state = IN;
        *ch = (char) c;
        strcat(str,ch);
    }
}
fclose(fp);
printf("%s",str);
}