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

  • SEARCH
  • Home
  • 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 7175361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:16:31+00:00 2026-05-28T16:16:31+00:00

I need to learn how to handle the char** in the C++ method below

  • 0

I need to learn how to handle the char** in the C++ method below through Python ctypes.
I was doing fine calling other methods that only need single pointers by using create_string_buffer(), but this method requires a pointer to an array of pointers.

ladybugConvertToMultipleBGRU32(
         LadybugContext          context,
        const  LadybugImage * pImage,
        unsigned char**        arpDestBuffers,
         LadybugImageInfo *   pImageInfo  )

How do I create a pointer to an array of six create_string_buffer(7963648) buffers in ctypes to pass to this C++ method for writing?

arpDestBuffers = pointer to [create_string_buffer(7963648) for i in xrange(6)]

Thank you for any help.


Both the answers given below work. I just didn’t realize I had another problem in my code which prevented me from seeing the results right away.
The first example is just as Luc wrote:

SixBuffers = c_char_p * 6
arpDestBuffers = SixBuffers(
            *[c_char_p(create_string_buffer(7963648).raw) for i in xrange(6)] )

The second example coming from omu_negru’s answer is:

arpDestBuffers = (POINTER(c_char) * 6)()
arpDestBuffers[:] = [create_string_buffer(7963648) for i in xrange(6)]

Both are accepted by the function and overwritten. Typing print repr(arpDestBuffers[4][:10]) before and after calling the function gives:

'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
'\x15\x10\x0e\xff\x15\x10\x0e\xff\x14\x0f'

which shows that the function successfully overwrote the buffer with data.

  • 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-05-28T16:16:31+00:00Added an answer on May 28, 2026 at 4:16 pm

    after you create all the string_buffers you need by calling create_string_buffer you can create an array for them with :

    var=(POINTER(c_char)*size)()  /* pointer_to_pointer */
    

    Then you can fill it up by indexing it with var[index] and finally just call your function using it as an argument…. Works fine for me and i just tested it on a function with the signature void test_fn(char*,char**,unsigned char); written in C

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

Sidebar

Related Questions

I'm lately feeling the need to learn a build tool. I'm looking through StackOverflow
I need to learn ADO.NET to build applications based on MS Office. I have
I need to learn about Postgresql. I'm trying to branch an application framework which
I need to learn more about creating setup projects from within Visual Studio to
I need to learn RegEx but don't have time to figure this out right
I need to learn C++ in order to learn building Nokia WRT and or
Sometimes I need to learn the type of an expression while programming in C
Do I need to learn the WCF Service trace viewer tool? I understand I
I am a newbie in Obj-C. I need to learn this better so please
I can do a few things with PowerPoint, but I need to learn more

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.