How to parse log files into text view using GLADE
hi to all,
i want to display the contents of log files (e.g. /var/log/messages) in the textview of the GUI, but i don't know how to do that. i'm using GLADE for the gui. please help me...:confused: |
Code:
/* This line gets a pointer to the text widget */ |
Hello,
Thanx for the info.. *****gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)), _(text_2_be_printed), -1);****** i just want to know if it is possible that i could have the text to be printed from a certain folder. (e.g from var/log/messages) i want to display the messages in the textview. |
First you gotta read the file into a variable, there is a great function for this in glib called g_file_get_contents() then do the code I posted above.
http://developer.gnome.org/doc/API/2...e-get-contents |
hello,
I've read the API with the link that u gave. I just want to ask if there is anything that i should add in my main.c inorder to use this function. I'm also confused on where to put this function, is it in callbacks.c, interface.c or main.c. Thank you very much for ur help, i just badly need it. |
That I think depends on how you want the program to work i.e if you want it to display the text when the user pushes a button. But most likely it will go into a function in callbacks.c.
|
hello,
thanks again, i can already view the contents of the file into the textview provided that the log file or any file will be place in the src folder of my project folder. i would have wanted to display a log file from any directory (e.g. from /var/log/messages.log) without copying this to my src file. would that be possible? |
Quote:
Quote:
|
Thanks con,
I can already display the contents of any file when i inserted g_file_get_contents()in my interface.c But when i tried to have it in my main.c or callbacks.c, its compilation is successful but when i run the program, it would display an error like this: The Application "myFilename" has quit unexpectedly. Hope u can help me with this. |
All times are GMT -5. The time now is 12:13 AM. |