Adding data to a sorted file in a sorted way | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Adding data to a sorted file in a sorted way

I have a file (text) where every line is in this form: Name(15 characters) LastName(20 char) Code(4char) And those names are sorted alphabetically. I will everytime get a name a last name and a code and try to insert that new data in the correspondant place For example if the line 3 and 4 are Jack Thomson 1234 Jordan Mark 5677 And the user enters James Kabelo 2615 I have to put him between jack and jordan. I m asked to do that using an intermediate file. Who can help please?

12th Dec 2019, 2:14 PM
Bochra El-Arfaoui
Bochra El-Arfaoui - avatar
1 Answer
0
And the function prototype is : FILE* add_pers(FILE *fp, FILE *fp1) Thanks. ♡
12th Dec 2019, 2:19 PM
Bochra El-Arfaoui
Bochra El-Arfaoui - avatar