No, you won't be able to write.
Do you want a list of errors, or just the problem you are reporting?
Just the one then:
char *text;
....
text[count]=c;
Where is "text" pointing when you access element "count"? What value have you given it? How many elements are allocated to it?
And just to be nice, here is hint about another one for when you fix that one:
while(1)
is not a loop you will ever get out of...