One possible noticeable difference with a normal target is that we print
using console.log() and other JS APIs, which can't print partial lines -
they always add a newline. So we buffer, and call those APIs only when we
reach a newline. As a result, you won't see partial lines printed until a
newline is reached.

If that's not the issue here, that might be an unknown bug somehow, a
testcase would help.

On Wed, Jul 15, 2020 at 4:40 AM Shlomi Fish <[email protected]> wrote:

> Hi!
>
> On Wed, 15 Jul 2020 02:32:24 -0700 (PDT)
> Bernhard Ege <[email protected]> wrote:
>
> > When I compile my C-code using emscripten and in C use printf and in
> > javascript receive the string via 'print', the newlines are removed.
> >
> > This makes it quite difficult to discern the difference between these
> two
> > printf's:
> >
> > printf("foo");
> > printf("foo\n");
> >
> > Visually, there is an important difference, though.
> >
> > Is there some flag or some way print can be told to return the newlines?
> >
>
> seems to work here:
>
> ```
> [shlomif@localhost shlomif-c-snippets]$ cat newline-printf.c
> /*
>  * License is the MIT/Expat license - http://opensource.org/licenses/MIT .
>  * ( https://en.wikipedia.org/wiki/MIT_License ).
>  */
> #include <stdio.h>
>
> int main(void)
> {
>     printf ("Hello World!");
>     printf ("(emcc)\n");
>
>     return 0;
> }
> [shlomif@localhost shlomif-c-snippets]$ emcc newline-printf.c
> [shlomif@localhost shlomif-c-snippets]$ ls -lrt *.js
> -rw-r--r--. 1 shlomif shlomif 110446 Jul 15 14:36 a.out.js
> [shlomif@localhost shlomif-c-snippets]$ node a.out.js
> Hello World!(emcc)
> [shlomif@localhost shlomif-c-snippets]$
> ```
>
> Can you share a self-contained sample? See:
> https://github.com/shlomif/how-to-share-code-online (read the whole
> thing).
>
> Thanks in advance.
>
> --
>
> Shlomi Fish       https://www.shlomifish.org/
> https://github.com/sindresorhus/awesome - curated list of lists
>
> At this point, I'd like to take a moment to speak to you about the Adobe
> PSD
> format. PSD is not a good format. PSD is not even a bad format. Calling it
> such would be an insult to other bad formats, such as PCX or JPEG. No, PSD
> is
> an abysmal format.
>     — https://github.com/gco/xee/blob/master/XeePhotoshopLoader.m
>
> Please reply to list if it's a mailing list post - https://shlom.in/reply
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/20200715144004.58141cb4%40telaviv1.shlomifish.org
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpS2bGpYQyZ3dR5fJsOdHsV46YoV6sBLmgHD%3D_Wf1PvWvg%40mail.gmail.com.

Reply via email to