GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Array Trouble

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
angel face
Familiar Face


Joined: 11 Feb 2008
Posts: 15

PostPosted: Wed Feb 20, 2008 8:01 pm    Post subject: Array Trouble Reply with quote

Hey guys.

Here's my problemo!...

Ive opened a text file and the contents is display in a textview.
Now I want to read what is in the textview into a character array (GArray). Does anybody know how to do this?

Really appreciate it :)
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 462
Location: Portland, OR USA

PostPosted: Sun Feb 24, 2008 6:17 pm    Post subject: Reply with quote

Well, I never actually use GArray, however, the string of text in the textview is a character array already. This is a fundamental concept of C. It is an array of single char values terminated by NULL (\0). Therefore, you can loop through it with a while or for loop and add each character to your GArray.
Back to top
angel face
Familiar Face


Joined: 11 Feb 2008
Posts: 15

PostPosted: Sun Feb 24, 2008 7:02 pm    Post subject: Reply with quote

I cant figure out how to directly access the array. I am using a pointer. No matter what i try i cant seem to access it. I dont know what im missing. Its quite annoying...any ideas?


gchar *text;

gtk_text_buffer_get_selection_bounds (buffer1, &start, &end);
text = gtk_text_buffer_get_text (buffer1, &start, &end, FALSE);

gtk_text_buffer_set_text (buffer2, text, -1);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP