0

My function is supposed to take user input in a temporary character array before validating it and copying it into a classes data member. Problem is, whenever the program reaches getline, it seems to ignore it and go to the end of the function definition. Not exactly sure why it's acting like this.

onemic
  • 59
  • 1
  • 2
  • 10

2 Answers2

1

You are probably getting this error due your assign operation at your if statement.

if (desc[0] = '\0') {

should be:

    if (desc[0] == '\0') {
         //do your code here
}
Engineer
  • 1,390
  • 3
  • 16
  • 33
nico
  • 838
  • 8
  • 27
0

Adding is.ignore() before the call to is.getline(desc, 61) fixes the problem

onemic
  • 59
  • 1
  • 2
  • 10