Need help with streams

From: Date: Mon, 14 Jun 2004 16:23:08 +0000
Subject: Need help with streams
Groups: php.internals 
Request: Send a blank email to internals+get-10444@lists.php.net to get a copy of this message
Hi, I'm working on ext/id3 (proposed in pecl) and I'm currently experiencing a problem. I got a function that is used to update the information in an ID3 tag. The user passes an array and I update all information that has been passed. One of the possible tokens is a genre ID which is represented by an integer: $new = array( 'title' => 'My Song', 'genre' => 23 ); Now I need to write the character that represents 34 to the stream. Using zend_hash_get_current_data(array, (void**) &data); I copy the value 23 into data. Then I convert it to long, if the value is not a long already: convert_to_long(*data); And now I move the pointer to the position where the genre ID is stored: php_stream_seek(stream, ID3_SEEK_V1_GENRE, SEEK_END); But I do not know how to write the value to the stream php_stream_write(stream, (char*)Z_LVAL_P(*data), 1); This does not produce the result I need, instead the file contains 48 at this position. If I return RETURN_LONG(Z_LVAL_P(*data); I get 23 as expected. Hope anybody is able to help or direct me to the correct mailinglist if internals is not the appropriate list. Best regards, Stephan

« previous php.internals (#10444) next »