Skip to content

trobert42/printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Printf() function

A simple implementation of the C function printf.

Project Name ft_printf
Description My implementation of printf() C function
Technologies C
External libraries malloc(), free(), write(), va_start(), va_arg(), va_copy(), va_end()

Usage

  gcl https://github.com/trobert42/printf.git
  cd printf
  make

It will create a library named libftprint.a. You can use the function ft_printf() if you include it inside your code and compile with the library. Here's how :

// main.c
#include "includes/ft_printf.h"

int main() {
    ft_printf("Hello %d \n", 42);
    return 0;
}

Then the compilation process :

gcc -Wall -Werror -Wextra main.c libftprintf.a

If you want to use it in your project, you can link it into your makefile:

CC = gcc
CFLAGS = -Wall -Werror -Wextra
LDFLAGS = -L. -lftprintf
SRC = main.c
OBJ = $(SRC:.c=.o)
EXE = a.out

.PHONY: all clean fclean re

all: $(EXE)

$(EXE): $(OBJ)
    $(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $@

%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

clean:
    rm -f $(OBJ)

fclean: clean
    rm -f $(EXE)

re: fclean all

About

Implementation of printf() C function

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published