Thanks a lot Rasmus, I have just (wrongly) assumed that the convert_to_string function tries to search for the 0 termination character.

Thanks,
Marco Bambini

On Nov 1, 2005, at 1:35 AM, Rasmus Lerdorf wrote:

Marco Bambini wrote:
I am developing a PHP plugin using PHP 4.4 SDK (not 5) and I need to access a parameter as a raw char * pointer instead of a string or any other C type. Until now to access parameters I am using the zend_get_parameters_ex routine and then the various convert_to_something routines. I think I can't use the convert_to_string function because my parameters is binary data but I wonder what I can use in this case, I need the raw char * pointer and not a C string...

I think you are a bit confused. There is no such thing as a C string. A string in C is simply an array of chars or a char *. In order to deal with binary data you have to carry the length of the data around with the char * which is exactly what PHP does. Without that you have no way of knowing how much binary data you have. So in short, you should be fine using the standard PHP API string.

-Rasmus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to