Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:39:02+00:00 2026-06-04T03:39:02+00:00

I am writing a text editor in C using gtk+-2.0 & gtksourceview-2.0. I’m trying

  • 0

I am writing a text editor in C using gtk+-2.0 & gtksourceview-2.0. I’m trying to run a number of tests on the data I am extracting from the buffer. Currently I am moving a pair of iters then getting a block of text delimited by these iters. Then checking this string using strstr, strchr,… However, this process of moving the iters, then reading the data, then performing the tests is quite cumbersome.

I also have extracted the entire doc (using the previously described process) to a gchar *. Would it be easier to work on this data? I’ve tried to use fgets and getline on this data, but the compiler complains:

warning: passing argument 3 of ‘fgets’ from incompatible pointer type
/usr/include/stdio.h:624:14: note: expected ‘struct FILE * __restrict__’ but argument is of type ‘gchar *’

or

warning: passing argument 1 of ‘getline’ from incompatible pointer type
/usr/include/stdio.h:671:20: note: expected ‘char ** __restrict__’ but argument is of type ‘gchar *’

I tried :

  int bytes_read;
  int nbytes = 100;
  char *my_string;
  GtkTextIter start;
  GtkTextIter end;

  wholeDoc = gtk_text_buffer_get_text(tbuffer,&start,&end,TRUE);

  my_string = (char *) malloc (nbytes + 1);
  bytes_read = getline (&my_string, &nbytes, wholeDoc);

but got the following error:

warning: pointer targets in passing argument 2 of ‘getline’ differ in signedness
/usr/include/stdio.h:671:20: note: expected ‘size_t * __restrict__’ but argument is of type ‘int *’

I’m looking for a way of checking, for example, the previous line by simply subtracting one from the loop index like each line is an element of an array. How can I get the data into this form? Please bear with me, I’m learning. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:39:03+00:00Added an answer on June 4, 2026 at 3:39 am

    You can split the string into an array of strings, one for each line. Use g_strsplit(). However, if you want to relate your data back to the position in the buffer, you’re better off using buffer iterators.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a text editor using gtk+-2.0 & gtksourceview-2.0. I am having trouble
i am writing a text editor in gtk 3 using python. in gtk 2
I am creating a text editor in C using gtk+-2.0 gtksourceview-2.0. I am having
I am writing a text editor and had planned on using the richtextbox control
I am writing a text editor(in java) where I am using a JTextArea for
I'm writing a text editor using C#, I know i'm just reinventing the wheel
i am writing a online text editor application, and i need to save data
I am writing a Text Editor using the Qt C++ framework. I'm using a
So, I'm writing a text editor, using MDI. I have a frame window, child
I am trying to write a text editor using RichTextBox . My concern is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.