Sorry about my yes.
However, with these codes I always get a new line whatever I do:
Code:
void Function_2(FILE *fPtr, char *Cont, int a, char *Nick)
{
char StringtoStore[1000000];
int answer, i=0;
char ch;
fPtr = fopen(Nick, "r");
printf("Please enter a string to store in the file %s\n", Nick);
if(fgets(Cont, a, fPtr) != NULL)
{
printf("The file contains data!!! Do you want to overwrite?(1 for YES/0 for NO): ");
scanf("%d", &answer);
if(answer == 1)
{
fPtr = fopen(Nick, "w");
while ((ch = getchar()) != EOF)
{
StringtoStore[i]=ch;
i++;
}
StringtoStore[i]='\0';
fputs(StringtoStore, fPtr);
fclose(fPtr);
}
else
{
printf("No overwriting will be executed");
fclose(fPtr);
}
}
else
{
fPtr = fopen(Nick, "w");
while ((ch = getchar()) != EOF)
{
StringtoStore[i]=ch;
i++;
}
StringtoStore[i]='\0';
fputs(StringtoStore, fPtr);
fclose(fPtr);
}
}