Re: how to handle newline in Max5

Aug 22, 2008 at 9:23am

Re: how to handle newline in Max5

Sorry for crossposting. I guess it makes more sense to post this question on
the dev list instead of the max5 one.

One solution I can think of is to break the strings containing “n” into
separate string and use a post() call for each line, but that seems a bit
silly…

Thijs

On Tue, Aug 19, 2008 at 12:07 PM, Thijs Koerselman <
thijskoerselman@gmail.com> wrote:

> I’ve noticed that, in Max5, the maxwindow doesn’t respond to newline
> characters anymore.
>
> Something like “foonbar” is printed “foo bar”, so it looks like the n
> results in a white space instead of a new line.
>
> I’m trying to connect the output of a library, which uses streams, to the
> maxwindow. Currently I buffer the stream and flush it to the maxwindow with
> a single post message. Something like this, using std::ostrstream :
>
> (streams are redirected so they connect to buffer_)
>
> buffer_ < < std::ends; // terminate
> char* s = buffer_.str(); // get c-string (calls freeze()
> implicitly)
> post(s); // post to maxwindow
> buffer_.freeze(false); // return memory to buffer
>
> This works for max4, since the newlines are respected, but it’s no use in
> Max5 since all the text appears on the same line.
>
> Any ideas on how to approach this in a way that works for both Max 4 and 5?
>
> Thanks, Thijs
>
>
>
>

#39393

You must be logged in to reply to this topic.