A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/332205.html below:

Help! Python either hangs or core dumps when calling C malloc

Help! Python either hangs or core dumps when calling C malloc Help! Python either hangs or core dumps when calling C mallocLarry Bates larry.bates at websafe.com
Thu Sep 8 13:04:16 EDT 2005
Question: Why not just use Python to read the file?

f=open(filename, 'rb')
fcontents=f.read()

If you need to manipulate what is in fcontents you
can use struct module and/or slicing.

Larry Bates


Lil wrote:
> Hi Everyone! I've been trying to figure out this weird bug in my
> program. I have a python program that calls a C function that reads in
> a binary file into a buffer. In the C program, buffer is allocated by
> calling malloc. The C program runs perfectly fine but when I use python
> to call the C function, it core dumps at malloc.
> I've tried multiple binary files with different sizes and the result
> is:
> 
> if file size is < 20 bytes , works fine
> if file size is > 20 bytes, it hangs or core dumps.
> 
> Please help!! 
> Lil
> 

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4