https://github.com/trobert42/printf
Implementation of printf() C function
https://github.com/trobert42/printf
printf
Last synced: 8 months ago
JSON representation
Implementation of printf() C function
- Host: GitHub
- URL: https://github.com/trobert42/printf
- Owner: trobert42
- Created: 2023-08-31T20:39:16.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-23T14:58:46.000Z (over 2 years ago)
- Last Synced: 2025-04-20T09:17:43.020Z (about 1 year ago)
- Topics: printf
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Printf() function
A simple implementation of the C function printf.
| Project Name | ft_printf |
| :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: |
| Description | My implementation of printf() C function |
| Technologies |
|
| External libraries | malloc(), free(), write(), va_start(), va_arg(), va_copy(), va_end() |
## Usage
```bash
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 :
```C
// main.c
#include "includes/ft_printf.h"
int main() {
ft_printf("Hello %d \n", 42);
return 0;
}
```
Then the compilation process :
```bash
gcc -Wall -Werror -Wextra main.c libftprintf.a
```
If you want to use it in your project, you can link it into your makefile:
```bash
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
```