Every time I input a string into my text file I want a space in between the strings inputted like this:
Input:
Stack
Overflow
Expected Output:
Stack Overflow
Current output:
StackOverflow
This is my function code:
void addDataToTextFile(FILE *fileptr)
{
char text[100];
fileptr = fopen("textfile.txt", "a");
printf("\n\nPlease enter some text: ");
fflush(stdin);
gets(text);
fprintf(fileptr, text);
fclose(fileptr);
printf("\n\nText has been added");
getch();
return;
}