Files
CS50---Harvard/Hayet_Classwork/phonebook.c
T
2026-06-01 13:15:48 +00:00

21 lines
373 B
C

#include <cs50.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// FILE here calls FILE function from stdio.h & "a" using for apend.
FILE *file = fopen("phonebook.csv", "a");
if (file == NULL)
{
return 1;
}
char *name = get_string("Name: ");
char *number = get_string("Number: ");
fprintf(file, "%s, %s\n", name, number);
fclose(file);
return 0;
}