STRCMPI

hi..
..I made a program in c++ that will read from a text file...'
..here's my code...but the output of that program is always..."Files Not Found!'
..is there any wrong with my code?...
.please tell me...'tnx'

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>

main()
{
char en[10],code[10],fname[20],lname[15],pos[30];
clrscr();
ifstream in("F:midterm.txt");
in>>code>>fname>>lname>>pos;
cout<<"Employee Number : ";
cin>>en;
if (strcmpi(code,en)==0)
{
cout<<"Employee Name : "<< fname<<lname<<endl;
cout<<"Position : "<< pos<<endl;
}
else
{
cout<<"Files Not Found!"<<endl;
}


in.close();
getch();
return 0;
}
Last edited on
"f:/midterm.txt"

EDIT: And I would suggest you get a compiler written after 1998.
Last edited on
..ukie..tnx'
..can you give me the syntax of tokenizing or the use of "STRTOK"?
..and a short sample program if you wont mind..'tnx again'
Don't use strtok, it's horrible. It modifies the input buffer.

There's an example here.
http://msdn.microsoft.com/en-us/library/2c8d19sb%28VS.71%29.aspx

As above, You might want to consider using the new I/O stream library.
Topic archived. No new replies allowed.