Please look at this code
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
int main()
{
ifstream fin;
fin.open("file.txt",ios::binary);
char s;
while(fin.get(s))
{
if (s+0==10)
cout<<"call";
else cout<<s;
}
getch();
return 0;
}
file.txt contails
dish
fish
delicious
the output is :
calldelicious
while it should have been
dishcallfishcalldeliciuos
Any idea what might be wrong?
Last edited on