0
0

Add main.* and remove .gitignore

This commit is contained in:
2021-08-16 08:26:30 +02:00
parent a808b91a50
commit 44692816d5
85 changed files with 1352 additions and 30 deletions

View File

@@ -0,0 +1,37 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/09 18:18:58 by gbaconni #+# #+# */
/* Updated: 2021/08/11 18:07:07 by gbaconni ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
char *ft_strncpy(char *dest, char *src, unsigned int n);
int main(void)
{
char src[32];
char dest[64];
unsigned int n;
char *result;
n = 0;
printf("Input String [max 31]: ");
scanf("%s", src);
printf("Input Size: ");
scanf("%d", &n);
result = ft_strncpy(dest, src, n);
printf("src=%s dest=%s n=%d result=%s (ft_strncpy)\n", src, dest, n, result);
result = strncpy(dest, src, n);
printf("src=%s dest=%s n=%d result=%s (strncpy)\n", src, dest, n, result);
return (0);
}

View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
#norminette -R CheckForbiddenSourceHeader ft_*.c
norminette -R CheckForbiddenSourceHeader
gcc -Wall -Wextra -Werror -o a.out *.c
echo $(basename $PWD):
./a.out
rm -f a.out