error coding for record I/O in files
hi,
this is a code for record I/O in files:
#include <stdio.h>
main()
{
FILE *fp;
char another='Y';
struct tmp
{
char name[40];
int age;
float bs;
};
struct tmp e;
fp=fopen("emmloyee.txt","w");
if(fp==NULL)
{
puts("Cannot open file\n");
exit(0);
}
while(another=='Y')
{
printf("Enter name,age and salary of employees\n");
scanf("%s%d%f",e.name,&e.age,&e.bs);
fprintf(fp,"%s%d\f",e.name,e.age,e.bs);
printf("Another record Y/N");
fflush(stdin);
another=getche();
}
fclose(fp);
}
and this is the compilation error:
[root@localhost i-o]# gcc -o l355 l355.c
/root/tmp/ccF5ymx6.o(.text+0xcd): In function `main':
: undefined reference to `getche'
collect2: ld returned 1 exit status
this is the error anywhere the getch() or getche() are used plz tell me
how i
can solve this problem.
Last edited by shams; 08-28-2004 at 09:48 AM.
|