GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Sep 23, 2014 8:21 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Array Trouble
PostPosted: Wed Feb 20, 2008 8:01 pm 
Offline
Familiar Face

Joined: Mon Feb 11, 2008 12:28 pm
Posts: 15
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 24, 2008 6:17 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 24, 2008 7:02 pm 
Offline
Familiar Face

Joined: Mon Feb 11, 2008 12:28 pm
Posts: 15
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);


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group