Re: Re: Need help with streams

From: Date: Mon, 14 Jun 2004 18:48:38 +0000
Subject: Re: Re: Need help with streams
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-10453@lists.php.net to get a copy of this message
Hi,
/* Not binary safe, but depending on your data that may be okay */ if (Z_STRLEN_PP(data) > 30) { php_stream_write(stream, Z_STRVAL_PP(data), 30); } else { php_stream_printf(stream TSRMLS_CC, "%-30s", Z_STRVAL_PP(data)); } Both solutions will pad the string with ' ', but I need to pad it with '\0'.
P.S. - As you might have noticed in the above code Z_STRVAL_PP(data) is the same as Z_STRVAL_P(*data). The same is true of the Z_LVAL_P(*data) you used in your previous question. I don't recall if using the _PP is dictated by the coding standards, but it's certainly in line with established convention. You'll probably find your code becomes more readable by others who are accostomed to the PHP Core if you stick to the secondary indirection macros.
OK, I'll adjust this in the extension. Thanks, Stephan

« previous php.internals (#10453) next »