Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libasync FileStream must createTrunc earlier #1176

Merged
merged 2 commits into from
Jul 9, 2015
Merged

Libasync FileStream must createTrunc earlier #1176

merged 2 commits into from
Jul 9, 2015

Conversation

etcimon
Copy link
Contributor

@etcimon etcimon commented Jul 9, 2015

When no data is to be written/read, createTrunc must still create the file to avoid further file operations to fail.

When no data is to be written/read, createTrunc must still create the file to avoid further file operations to fail.
{ // touch
import std.c.stdio;
import std.string : toStringz;
FILE * f = fopen(path_str.toStringz, "w\0".ptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually just directly use "w" here. String constants always have an implicit zero appended in memory and implicitly cast to const(char)*.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this?

@s-ludwig
Copy link
Member

s-ludwig commented Jul 9, 2015

Exactly!

s-ludwig added a commit that referenced this pull request Jul 9, 2015
Libasync FileStream must createTrunc earlier
@s-ludwig s-ludwig merged commit 333b846 into vibe-d:master Jul 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants