Update 1st June 26
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user