Page 1 of 1

number to string conversion

Posted: Mon Oct 27, 2008 2:39 pm
by edexter
I am converting (or trying to convert) a rapidq example that generates a sound and plays it..

dim soundstream as memorystream
` I came up with taking the first letter off of many of thier commands and simple replacement

soundstream.writenum(44100, ?4)
soundstream.writenum(1, 2)

I think I have conversion routines for those but I get

soundstream.writenum(num,2)

where num is two bytes with a decimal and I didn`t see a conversion routine.
that allows me to write it as

soundstream.write()


thanks for the help in advance, it will make a cool example.





number to string conversion

Posted: Mon Oct 27, 2008 4:49 pm
by Marco
Hi, you can only write strings to a stream but you can covert the numbers with
chr$(num)  byte 1 byte
mkw$(num) word 2 bytes
mki$(num) integer 4 bytes
mkd$(num) double 8 bytes
mks$(num) single  4 bytes
they give a byte reprensative of the number, to save a 10000 and a 2 you can do
write(mkw$(10000)+chr$(2)

best regards