read func is waiting

hdak
hi, when i read a button status read() func waiting until button pressed,
app freezes.now i using fread but my app is crashing.app says "The program
has unexpectedly finished." How to read button status without waiting for.