file-format-problem?



hi,
i cant seem to figure this out...

i have a file which is written to (append mode) using
fwrite, from a c program, which spawns the gtk-gui as
a seperate thread. there is a gtk_timeout_add 
function in the gui which reads the file using fread.
I do have locks to protect the file.

The problem is that the text widget does not accept
and display the data read from the file, it crashes
with a segmentation fault.

And when i open the file to have a look at the
contents, i see unreadable symbols. 

On the other hand, if i create the file myself with an
editer, with readable data, and disable the file
creation through the program, that also works fine. 
Also passing my own string to the text widget at the
last stage when i have to display is also fine, no
crash.

I cant understand, is there some problem with the way
i am writing to the file? i write with fwrite and put
unsigned long data and read it with char (byte
wise),after a certain no of unsigned long reads. Why
is there a problem in displaying that char data? 

Maybe this is more a general question, but also why is
the file not in a readable form when i open and see
it?

thanks in advance,
regards,
anuradha.

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]