Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ** hello.c for source in /home/admin/Documents/Programming/hello/source
- **
- ** Made by Thomas Murgia
- ** Login <garuda1@protonmail.com>
- **
- ** Started on Mon May 30 19:09:11 2016 Thomas Murgia
- ** Last update Mon May 30 19:09:11 2016 Thomas Murgia
- */
- #include <sys/types.h>
- #include <unistd.h>
- #define STDIN 0
- #define STDOUT 1
- #define STDERR 2
- #define SUCCESS 0
- #define FAILURE 1
- size_t my_putc(const char c)
- {
- if (write(STDOUT, &c, 1))
- return (0);
- return (1);
- }
- size_t my_puts(const char *str)
- {
- size_t i;
- if (str == NULL)
- return (FAILURE);
- i = 0;
- while (*(str + i) != '\0')
- my_putc(str[i++]);
- return (i);
- }
- int main(int argc, char **argv)
- {
- my_puts("Hello, world!\n");
- return (SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement