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 1024869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:50:32+00:00 2026-05-16T11:50:32+00:00

Hallo! I want a blob object which I can pass around in python and

  • 0

Hallo!

I want a blob object which I can pass around in python and from time to time give it to a C++ function to write to.

ctypes seems the way to go but I have problem with the python standard functions.

For example:

>>> import ctypes
>>> T=ctypes.c_byte * 1000
>>> blob = T()
>>> ctypes.pointer(blob)
<__main__.LP_c_byte_Array_1000 object at 0x7f6558795200>

# Do stuff with blob data through the pointer in C++

>>> f = open('test.bin', 'wb')
>>> f.write(blob)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument 1 must be string or buffer, not _ctypes.ArrayType

I would really like to avoid copying the data if not necessary.

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-05-16T11:50:32+00:00Added an answer on May 16, 2026 at 11:50 am

    You’ll probably have better luck with using string buffers and accessing the content through the raw attribute value

    pstr = ctypes.create_string_buffer( 1000 )
    f.write( pstr.raw )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hallo all. i want to create a .htaccess file if i type subdomain.domain.com can
hello i want to pass the value of a function to any other function
Hallo, I want to copy my Active Directory Users, Groups and Group Memberships from
Hallo in c# i got two hashtable object of which key/value pair is same
I want to match a String which looks like this: [lang_de]Hallo![/lang_de][lang_en]Hello![/lang_en]HeyHo[lang_es]Hola![/lang_es] I want the
Hallo, i want to make a custom stackpanel in WPF, which shall automatically resizes
Hallo I want to make an file upload. The script should take the image,
Hallo everyone, i have a list of nodes ListNode and i want to draw
Just a blackout, I want the String hello hallo tjena hej tere to an
Hello I want to read output of command which gives progress bar like output

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.