[Pyrex] Newbie question

Natsagdorj Shagdar natsag2000 at yahoo.com
Fri Dec 15 12:02:30 UTC 2006


Dear list ?

I am new to Pyrex. I started one small project to experience in Pyrex. I am learning Pyrex by doing ;)

So, here is my first problem:
in my .pyx file i have C function which takes the file name as parameter and should return the file data pointer and give the file size to the second parameter. 

# cutted several lines for test
cdef char *ReadFileToBuffer(char *FileName, unsigned long *Size):
    FILE *fToOpen
    char *Buf
    fToOpen = fopen(FileName, "rb")
    if fToOpen is None:
        print "Cannot open the file: %s\n" % szFileName
    if fToOpen is None :
        fclose(fToOpen)
    return pBuf


in the pyx file, there is also one Python function that should be run from outside.

def ReadFile(self, FileName):
    cdef unsigned long plSize
    print ReadFileIntoBuffer(FileName, plSize)


But it gives an error " cannot assign type 'unsigned long' to 'unsigned long (*)"

What did I wrong ? Any help most appreciated.

Best regards
Nagi



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Pyrex mailing list