#include #include FILE *_file; char name[30]; char email[30]; char telephone[12]; char city[30]; int count; void replstr(char s[], char chr, char newchar) { int i = 0; while(s[i] != '\0') { if(s[i] == chr) s[i] = newchar; i++; } } int main (void) { _file = fopen("X:\\Your\\File\\Path\\Here.txt", "w"); if(_file == NULL){ printf("ERROR: Failed to open File for writing!"); return -1; } printf("How many cards do you want to create? "); scanf("%d", &count); printf("Creating %d cards\r\n", count); for(int i = 0; i < count; i++) { printf("[%d] Name, Telephone, Email, City: ", i + 1); scanf("%s %s %s %s", name, telephone, email, city); replstr(name, '_', ' '); replstr(name, '/', ','); replstr(city, '_', ' '); replstr(city, '/', ','); fprintf(_file, "%s, %s, %s, %s\r\n", name, telephone, email, city); } printf ("Done! Closing out now!"); fclose(_file); return 0; }