Please help? I need to read house details from a file , store them in an array and then print the list of houses. I think what I have below is correct but how do I add a new house?
Help here would be much appreciated. Thanks.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *fp;
char filename[15];
int ch;
printf("\nEnter filename ?\n");
gets(filename);
if((fp=fopen(filename,"r"))==NULL)
{
printf("\nUnable to open'%s':%s",filename);
return 1;
}
while((ch=getc(fp))!=EOF)
putchar(ch);
fclose(fp);
return 0;
}