I wrote this :
#include <stdio.h>
#include <stdlib.h>
FILE * fp;
char Name[101], Address[101], Email[101], Gender[9], k;
int Phone[10];
int main()
{
fp = fopen("Mallon.txt", "a");
fflush(stdin);
printf("Name:");
fgets(Name, sizeof(Name), stdin);
fflush(stdin);
printf("Address:");
fgets(Address, sizeof(Address), stdin);
fprintf(fp, "%s %s", Name, Address);
return(0);
}
And it is printing in the file this:
Name
Address
But i want:
Name Address
What should I do to print in the file the selected name and address in the same line. I think that fprintf when I press enter to write the address sents the address in the next line.