# Writing non-ascii or binary data to ofstream?

**URL:** <https://community.freefem.org/t/writing-non-ascii-or-binary-data-to-ofstream/2545>\
**Category:** General Discussion\
**Created:** [June 15, 2023, 1:56pm UTC](https://community.freefem.org/t/writing-non-ascii-or-binary-data-to-ofstream/2545 "2023-06-15T13:56:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [June 15, 2023, 1:56pm UTC](https://community.freefem.org/t/writing-non-ascii-or-binary-data-to-ofstream/2545/1 "2023-06-15T13:56:39Z")

</div>

I can’t find anyway to write a simple “0” or other char to  
ofstream. Syntax highligher colors “char” but it is not accepted  
by FF. I and adding “binary” to the ofstream ctor does nothing afaict.

Thanks.

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [June 16, 2023, 4:26pm UTC](https://community.freefem.org/t/writing-non-ascii-or-binary-data-to-ofstream/2545/2 "2023-06-16T16:26:04Z")

</div>

why not write as type `string`?

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [June 16, 2023, 4:42pm UTC](https://community.freefem.org/t/writing-non-ascii-or-binary-data-to-ofstream/2545/3 "2023-06-16T16:42:55Z")

</div>

How do I get a non-ASCII char into a string? I tried some simple  
escape codes nothing seemed to work.  
Thanks.
