From 8aa0e40010d97e15ede2d2513f828bc35c8c46c3 Mon Sep 17 00:00:00 2001
From: Alec <alec.schmidt@hesge.ch>
Date: Thu, 2 Jun 2022 13:36:25 +0200
Subject: [PATCH] =?UTF-8?q?TP=20termin=C3=A9,=20il=20faut=20rajouter=20de?=
 =?UTF-8?q?=20la=20data=20pour=20feed=20la=20db,=20je=20pourrais=20essayer?=
 =?UTF-8?q?=20la=20suppression=20et=20la=20persistence?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bp_tree.c |  3 ++-
 main.c    | 23 ++++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/bp_tree.c b/bp_tree.c
index 51b33bc..6b80f94 100644
--- a/bp_tree.c
+++ b/bp_tree.c
@@ -46,6 +46,7 @@ void bp_node_shift(node *nd, int index) {
     for (int i = M - 1; i > index; i--) {
         nd->data[i] = nd->data[i - 1];
         nd->childs[i + 1] = nd->childs[i];
+        nd->user[i] = nd->user[i - 1];
     }
 }
 
@@ -379,7 +380,7 @@ void bp_print_entry(entry person) {
         printf("Cette personne n'existe pas\n");
         return;
     }
-    printf("%ld\n", strlen(person.l_name));
+
     printf("NOM : %s\n", person.l_name);
     printf("PRENOM : %s\n", person.f_name);
     printf("TELEPHONE : %s\n", person.phone);
diff --git a/main.c b/main.c
index 05ce826..0d8a31d 100644
--- a/main.c
+++ b/main.c
@@ -23,13 +23,30 @@ int main() {
     person.birth = test;
     tree = bp_insert_val(tree, person);
 
-    char phone_search[11] = {"0789444425"};
+    strcpy(person.f_name, "Richard\0");
+    strcpy(person.l_name, "Tyarks\0");
+    strcpy(person.phone, "0788909566\0");
+    test.day = 7;
+    test.month = 10;
+    test.year = 99;
+    person.birth = test;
+    tree = bp_insert_val(tree, person);
+
+    strcpy(person.f_name, "Vincent\0");
+    strcpy(person.l_name, "\0");
+    strcpy(person.phone, "0795787730\0");
+    test.day = 24;
+    test.month = 5;
+    test.year = 101;
+    person.birth = test;
+    tree = bp_insert_val(tree, person);
+
+    char phone_search[11] = {"0788909566"};
     bp_print(tree, 0);
-    strcpy(person.phone, "0789444425\0");
     printf("\n|||||||||\n");
     printf("Recherche par n° de téléphone : \n");
 
-    bp_search(tree, person.phone);
+    bp_search(tree, phone_search);
 
     /*
     tree = bp_insert_val(tree, 6);
-- 
GitLab