Skip to content

Instantly share code, notes, and snippets.

@nasitra
Created April 1, 2015 12:20
Show Gist options
  • Save nasitra/dca40c6b5d30499fdba4 to your computer and use it in GitHub Desktop.
Save nasitra/dca40c6b5d30499fdba4 to your computer and use it in GitHub Desktop.
read() file no response?

NG

if (fd = open("test.txt", O_RDONLY) == -1) {
  printf("open error\n");
}
read(fd, buf, size); // No response?(fd == 0)

OK

if ((fd = open("test.txt", O_RDONLY)) == -1) {
  printf("open error\n");
}
read(fd, buf, size);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment