Example #1
0
int main(){
    int len;
    char line[MAXLINE];
    char reverse[MAXLINE];

    len = get_line_and_len(line, MAXLINE);
    printf("Original line is %s\n", line);

    reverse_line(reverse, line, len);
    printf("Reverse line is %s\n", reverse);
    return 0;
}
Example #2
0
static int	main_tests(int argc, char **argv, int *fd, t_init *n)
{
	if (argc < 2 || (*fd = open(argv[1], O_RDONLY)) < 0)
	{
		ft_putstr("open error or too few arguments.\n");
		return (-1);
	}
	if ((get_line_and_len(*fd, &n->parsed)) < 0)
	{
		ft_putstr("read error.");
		return (-2);
	}
	if ((test_valid(n->parsed, n)) < 0)
	{
		ft_putstr("parse error, file is |\n");
		ft_putstr(n->parsed);
		return (-3);
	}
	return (-5);
}