Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • Wow, I didn't see that ... note that fd < 0 would be wrong. Commented Apr 16, 2015 at 18:35
  • Note: OP is using open, not fopen. So fd < 0 would have been OK, but he wrote *fd = open() Commented Apr 16, 2015 at 18:44
  • 1
    Agreed @AlterMann, edited, thanks! I could also get rid of stdlib too I guess. Commented Apr 16, 2015 at 18:54
  • 1
    Me neither @chux, thanks for the nice discussion. :) Commented Apr 16, 2015 at 21:40
  • 1
    Don't forget to call fclose(fd); afterwards. Commented Apr 18, 2023 at 8:28