I took your advice and it doesn't crash any more , but when I open the program this is what is does :
write the month: february <---(i write the month, press enter then it just skips to the end of the loop)
what is happening:loadingdo you wish to put in any more dates [y/n] <-----(like this)
i have included the file if you would like to see for yourself, and the code:
Code:
#include <conio.h>
#include <stdio.h>
int main(int arge, char *argv[])
{
FILE *pfile;
int month;
char sced[21];
float date[32];
char answer = 'y';
char num1;
char february;
pfile = fopen("database2.txt", "w");
if (pfile != NULL)
{
while (answer == 'y')
{
printf("write the month: ");
if (month == february);
{
february = 01;
}
scanf("%d", &month);
printf("what is happening:");
scanf("%d", sced);
printf("loading");
fprintf(pfile,"%s", sced);
fprintf(pfile,"%d\n", month);
printf("do you wish to put in any more dates [y/n] \n");
answer = getch();
}
fclose(pfile);
}
else
{
printf("could not open the file.\n");
}
getch();
}