On Thursday, 29 January 2015 at 15:25:09 UTC, Mike Parker wrote:
On 1/29/2015 11:40 PM, CodeSun wrote:
Recently, I found something really weird when I use strerror_t
function
which is declared inside std.c.string.
The code snippet is listed below:
import std.c.string;
import core.stdc.errno;
On Thursday, 29 January 2015 at 14:40:32 UTC, CodeSun wrote:
writeln(cast(string)buf);
Casting to string is often a mistake, here it might be the
problem because you didn't check for the zero terminator, so the
writeln prints all the garbage at the end of the buffer too.
I'd try
On 1/29/2015 11:40 PM, CodeSun wrote:
Recently, I found something really weird when I use strerror_t function
which is declared inside std.c.string.
The code snippet is listed below:
import std.c.string;
import core.stdc.errno;
void main() {
import std.stdio;
char[128] buf;
Recently, I found something really weird when I use strerror_t
function which is declared inside std.c.string.
The code snippet is listed below:
import std.c.string;
import core.stdc.errno;
void main() {
import std.stdio;
char[128] buf;
strerror_r(errno, buf.ptr,