ISD-Sound-and-Lights / eyepatch

Fixtures in. Standard out. -- A CLI utility to create a patch standard from a list of lighting fixtures.
0 stars 0 forks source link

Error when having spaces in device names #8

Open il8677 opened 6 years ago

il8677 commented 6 years ago

I can either sanatise all the spaces, or make it so that spaces are accepted

ghost commented 6 years ago

How does this happen? Shouldn't it just be a string attribute of the instance?

il8677 commented 6 years ago

When asked for the name of a fixture, it gathers straight from stdin, bun when doing this it only accepts 1 word. Then it moves on the the next line of code. Next time the program tries takin data from stdin, it won't wait for user input since there still is leftover from last time. This causes the problem of: it asks for a name, I the user puts in a name with a space, the program asks for the quantity of fixtures, spillover from user input causes quantity to be taken as part of user inputted name, which not only prevents there user from inputting a quantity, it also tries to store a string into an int var.

This could be solved either by using getline(). Or by flushing stdin after accepting one input, it is generally easier to go for the second option, but I still have not figured out how (I have tried)

ghost commented 6 years ago

And this, kids, is why we all love C++.