On Mar 26, 12:24 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 25 Mar 2008 08:24:13 -0700 (PDT), Craig <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > 41 0 0 0 > > 7 0 0 0 > > Which makes sense for two reasons: > > 1. It would only return the non-space-filled part of the returned key. > > 2. At least from VB6, the variable does not even have to be used > > before the call. > > Hmmm... I wonder what the library would have done if you just passed > a 0 to it... Rather than even doing that SysAlloc...() mess... > > PriKey = ctypes.int32(0) #or whatever the syntax was > > ... byref(PriKey) > > May with an effective null pointer the library would just allocate > directly rather than trying to determine the length field of the one > passed in. > > Something for the future, maybe... > > > print " DistID = \x22%s\x22" % DCOD.DistID > > You realize you can avoid those \x22 literals by changing the outer > quotes? > > print ' DistID = "%s" ' % .... > > or using triples > > print """ DistID = "%s" """ % ... > > > > > In other files, some of those fields are VB6 currency types, which > > have been described as 8-byte integers with an implied 4 decimal > > places (which I guess would be __int64 or c_longlong and then divide > > by 10,000, or simply put a decimal point 4 away from the end). > > Don't divide directly; you might lose significance as the result is > converted to double-precision float. > > You could possibly convert to string, splice in that . and then pass > the result to the Decimal module/type... > -- > Wulfraed Dennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/
I made these changes: # SecKey = windll.oleaut32.SysAllocStringByteLen("1234567890123456789012345678901234567890\x00", 41) SecKey = c_int32(0) ci_SecKey = c_int32(SecKey) # PriKey = windll.oleaut32.SysAllocStringByteLen("ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234\x00", 41) PriKey = c_int32(0) ci_PriKey = c_int32(PriKey) And got: Traceback (most recent call last): File "C:\temp\vbisam_test_2.py", line 123, in <module> ci_SecKey = c_int32(SecKey) TypeError: an integer is required Creating 2 "dummy" BSTR's isn't too bad of an option anyway. No, being somewhat new I didn't realize I could use (') in place if (") if I wanted to use a (") as a literal, but it seems to make a lot of sense now. I don't understand why I never tried it. As for the division vs. string manipulation, I agree - the string seems to be the simplest way to insure no loss of data. Thanks for all the input. -- http://mail.python.org/mailman/listinfo/python-list