I have a problem with cin.getline using Borland C++
Below is a copy of a function which works fine until referenced within a
WHILE loop, then the cin.getline doesn't execute, however, if I put two
identical lines it does execute. The problem also occurs with other string
input functions.
int addrec()
{
studentData student;
int cnt = 0;
while (cnt == 0)
{
cout << "Add record" << endl;
cout << "Name: " ;
cin.getline(student.name,30);
cout << student.name << endl;
char *s1 = student.name; //looks for cr
char *s2 = "";
int st;
st = strcmp(s1,s2);
if (st == 0)
cnt = 1;
}
return 0;
}
--- Maximus 3.01
---------------
* Origin: Friendship Corner Albany, Tx 1-915-762-2745 (1:392/15)
|