lenght of char buffers in PyArg_ParseTuple

Discussion in 'Python' started by Patrick Stinson, Jun 10, 2004.

  1. is there any way to figure out how long the string buffer of a passed string
    object was after PyArg_ParseTuple(args, "s", &mybuffer)?

    I'm potentially copying data from a call to socket.inet_pton(), which is a
    string type but strlen(mybuffer) should not work in the case of a
    NUL-terminator before the end of the buffer.

    Cheers
     
    Patrick Stinson, Jun 10, 2004
    #1
    1. Advertising

  2. Patrick Stinson

    Duncan Booth Guest

    Patrick Stinson <> wrote in
    news::

    > is there any way to figure out how long the string buffer of a passed
    > string object was after PyArg_ParseTuple(args, "s", &mybuffer)?


    No, but there is if you call PyArg_ParseTuple(args, "s#", &mybuffer,
    &length) instead.
     
    Duncan Booth, Jun 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vbMark
    Replies:
    3
    Views:
    404
    vbMark
    Jun 29, 2004
  2. TomislaW

    Repeater and Lenght ArrayList

    TomislaW, Dec 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    313
    Eliyahu Goldin
    Dec 8, 2004
  3. =?Utf-8?B?QVZM?=

    string.lenght vs string.empty

    =?Utf-8?B?QVZM?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    6,498
    Steve C. Orr [MVP, MCSD]
    Apr 29, 2005
  4. syncman
    Replies:
    4
    Views:
    1,758
    Rob Williscroft
    Jan 20, 2004
  5. lovecreatesbeauty
    Replies:
    1
    Views:
    1,099
    Ian Collins
    May 9, 2006
Loading...

Share This Page