How can I write a little piece of text into a .txt
file?
I've been Googling for over 3-4 hours, but can't find out how to do it.
fwrite();
has so many arguments, and I don't know how to use it.
What's the easiest function to use when you only want to write a name and a few numbers to a .txt
file?
char name;
int number;
FILE *f;
f = fopen("contacts.pcl", "a");
printf("
New contact name: ");
scanf("%s", &name);
printf("New contact number: ");
scanf("%i", &number);
fprintf(f, "%c
[ %d ]
", name, number);
fclose(f);
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…