0
int j=1;
fstream kd("Gydytojai.sed");
while (!kd.eof())      // Checking if the entry already exist;
 { if (gydmas[j].vardas==pgyd.vardas) {ShowMessage(L"Gydytojo id jau egzistuoja");
                                        pagalb=true;};      // if the entry exist, variable pagalb becomes true
 j++;};
kd.close();

Well, i'm checking if in the file Gydytojai.sed while it is not end of line checking if my input text, which i compared with the array of structure from file is the same, if it's then pagalb becomes true. And in this thing i get an error of project. File is not empty.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by En1ro
0

You are not reading anything from the file, you only open the file and then enter an infinite loop incrementing j on every round. You must read in some data in order to compare the value of vardas.

Furthermore, about while(!kd.eof()) , please take a look in here
http://www.daniweb.com/forums/post155265-18.html

And lastly, you initialize int j=1; , is that on purpose? If not, notice that you are not comparing gydmas[[B]0[/B]] at all. Array indexes start from 0, not from 1.

0

You are not reading anything from the file, you only open the file and then enter an infinite loop incrementing j on every round. You must read in some data in order to compare the value of vardas.

Furthermore, about while(!kd.eof()) , please take a look in here
http://www.daniweb.com/forums/post155265-18.html

And lastly, you initialize int j=1; , is that on purpose? If not, notice that you are not comparing gydmas[[B]0[/B]] at all. Array indexes start from 0, not from 1.

I know about index, and i written it from 1, not from 0 ;) Anyway thanks for link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.