On Tue, Dec 13, 2011 at 5:53 AM, Paul Davis <paul@linuxaudiosystems.com> wrote:
On Mon, Dec 12, 2011 at 11:44 PM, Iain Duncan <iainduncanlists@gmail.com> wrote:

> Yup, what I'm talking about is being able to put a data structure on to the
> ring buffer. It needs be castable to a  const *char, so the structure needs
> a way to be converted to a string.

these two statements are not related. in an awful lot of C code,
"pointer to char" means "pointer". in newer better C code, one uses
void*. in newer, better code than that, one doesn't use raw pointers
much at all.

are you working in C or C++ ?

Thanks Paul. I'm working in C++, but I'm using the jack C api, which from the docs I see has a signature for  
size_t jack_ringbuffer_write ( jack_ringbuffer_t * rb,  const char * src, size_t cnt )

My DataMessage structure is just a simple C structure for now. Is there a recommended way of writing it to the ringbuffer given that I want to do something like this:

void MessageQueue::push( DataMessage msg ){
    // write to the ring buffer, converting DataMessage to a string
    unsigned int written = jack_ringbuffer_write( mRingBuffer, (char *) &msg , sizeof(DataMessage) );
   // etc
}


Thanks
Iain