--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Please help me...
Sir/Ma'am I think I got this one working using this code but I have one problem:
this is the code:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
FILE *fp;
char code[80],code2[80], ename[80];
int elevel;
clrscr();
if((fp = fopen("samplete.txt","r"))==NULL) {
printf("cannot open file.\n");
}
printf("Enter ID: ");
gets(code2);
while(!feof(fp)) {
fscanf(fp,"%s %s %d",code,ename,&elevel);
if(strcmp(code2,code)) {
printf("%s %s %d",code,ename,elevel);
break;
}
}
fclose(fp);
getch();
}
The problem is it only display the first record or first line of text in my notepad file
lets say when I Enter the ID: ST-0002
it only display the first record or the first line of text file which is: ST-0001, Eddie_VanHalen, 1
it should be: ST-0002, James_Hatfield, 2
Please help me... thanks in advanced