21 lines
373 B
C
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;
|
|
}
|