Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include <fcntl.h>
- void ft_putchar(int ft, char c)
- {
- write(ft, &c, 1);
- }
- int main(int argc, char **argv)
- {
- int fd;
- char buf[1];
- if (argc > 2)
- write(1, "Too many arguments.\n", 20);
- else if (argc == 1)
- write(1, "File name missing.\n", 19);
- else
- {
- fd = open(name, O_RDONLY);
- while (read(fd, buf, sizeof(buf)))
- {
- write(1, buf, sizeof(buf));
- }
- close(fd);
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement