My program is:
/****************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main()
{
char str[80];
FILE *fp;
if((fp = fopen("Taxi Information.txt", "w"))==NULL)
{
printf("Cannot open file.\n"); exit(1);
}
do {
printf("Enter a string (CR to quit):\n");
scanf_s("%s", str); // Type slivia todorof
gets(str);
strcat(str, "\n");
} while(*str!='\n');
}
/****************************************/
If I type: silvia todorof , I have two problems:
1st problem: After typing "silvia todorof", appears "Enter a string (CR to quit)", as required, but if I hit Enter it did not quit and stuck there; but it goes out if I write ^z with two times Enter.
2nd problem: the text file is empty.
Thanks
Silvia