[libcxx-commits] [PATCH] D150044: [libc++][print] Adds FILE functions.
Mikael Holmén via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 23 23:35:55 PDT 2023
uabelho added inline comments.
================
Comment at: libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp:40
+
+ FILE* file = fmemopen(buffer.data(), buffer.size(), "wb");
+ assert(file);
----------------
When I run this testcase the assert on line 48 below fails for me, and it seems to be because the "fmemopen" call here writes '\0' at the first byte in buffer.
I really doen't know anything about this and if I read at
https://man7.org/linux/man-pages/man3/fmemopen.3.html
it says
```
w The stream is opened for writing.
```
and also
```
w+ Open the stream for reading and writing. The buffer
contents are truncated (i.e., '\0' is placed in the first
byte of the buffer).
```
So it seems like when I run this in my environment "w" partly does what "w+" should do.
Does this problem sound familiar to anyone?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150044/new/
https://reviews.llvm.org/D150044
More information about the libcxx-commits
mailing list