main()
{
	int fd;		/* file descriptor */
	char s[15];	/* 15 chars max.   */

	/*
	 * First try to open the file.  
	 */
	if ((fd = open("foo", 0)) < 0) {
		/*
		 * Write to file descriptor 1 (stdout).
		 */
		write(1, "Cannot open foo.\en", 17);
		exit(1);
	}

	/*
	 * Now read in 15 bytes.  Note that we may not
	 * get all 15, the number read is returned (we're
	 * ignoring it).  Also note that unlike stdio,
	 * we don't say "%s".  Thus, we may get spaces 
	 * in our string, since we just ask for the next
	 * 15 bytes, whatever they are.
	 */
	read(fd, s, sizeof(s));

	/*
	 * Now we need to terminate the string with a NULL, since
	 * this is not done by read.
	 */
	s[sizeof(s)\-1] = 0;

	/*
	 * Now we write out s.  Note that
	 * we use strlen(), not sizeof().
	 */
	write(1, s, strlen(s));

	/*
	 * Now close the file.
	 */
	close(fd);
}
