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.

Reply via email to